From 42d75aefe4529d94480d1cab4df1e5f725e4d072 Mon Sep 17 00:00:00 2001
From: Khosrow Moossavi <khos2ow@gmail.com>
Date: Sat, 01 Sep 2018 12:18:10 +0000
Subject: [PATCH] Enable RTL layout by providing 'rtl = true' in the config (#72)

---
 layouts/_default/baseof.html |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 32674d6..3679df1 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -28,6 +28,18 @@
       <link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
     {{ end }}
 
+    {{ if .Site.Params.rtl }}
+      {{ if .Site.IsServer }}
+        {{ $cssOpts := (dict "targetPath" "css/coder-rtl.css" "enableSourceMap" true ) }}
+        {{ $styles := resources.Get "scss/coder-rtl.scss" | resources.ExecuteAsTemplate "style.coder-rtl.css" . | toCSS $cssOpts }}
+        <link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
+      {{ else }}
+        {{ $cssOpts := (dict "targetPath" "css/coder-rtl.css" ) }}
+        {{ $styles := resources.Get "scss/coder-rtl.scss" | resources.ExecuteAsTemplate "style.coder-rtl.css" . | toCSS $cssOpts | minify | fingerprint }}
+        <link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
+      {{ end }}
+    {{ end }}
+
     {{ range .Site.Params.custom_css }}
       <link rel="stylesheet" href="{{ . | absURL }}">
     {{ end }}
@@ -43,7 +55,7 @@
     {{ .Hugo.Generator }}
   </head>
 
-  <body>
+  <body class="{{ if .Site.Params.rtl }}rtl{{ end }}">
     <main class="wrapper">
       {{ partial "header.html" . }}
 

--
Gitblit v1.10.0