diff --git a/assets/css/auto.css b/assets/css/auto.css
index dcb5667d46..9b966e0d28 100644
--- a/assets/css/auto.css
+++ b/assets/css/auto.css
@@ -1,2 +1,2 @@
-@import "{{ printf "%s-%s%s.css" .prefix .light .suffix }}" screen and (prefers-color-scheme: light);
-@import "{{ printf "%s-%s%s.css" .prefix .dark .suffix }}" screen and (prefers-color-scheme: dark);
+@import "{{ printf "%s-%s.css" .prefix .light }}" screen and (prefers-color-scheme: light);
+@import "{{ printf "%s-%s.css" .prefix .dark }}" screen and (prefers-color-scheme: dark);
diff --git a/assets/css/format-print.css b/assets/css/format-print.css
index 4779a48c3a..90069a3245 100644
--- a/assets/css/format-print.css
+++ b/assets/css/format-print.css
@@ -1,4 +1,4 @@
-@import "{{ printf "theme-%s%s.css" .themevariant.identifier .mod }}";
+@import "{{ printf "theme-%s.css" .themevariant.identifier }}";
@import "{{ printf "chroma-%s.css" .themevariant.chroma }}";
#R-sidebar {
diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml
index dafe22018f..e2e7ff897e 100644
--- a/exampleSite/config/_default/params.toml
+++ b/exampleSite/config/_default/params.toml
@@ -75,17 +75,6 @@ themeVariant = [
{ identifier = "red" }
]
-# Filename suffix for variant files.
-# Default: not set
-# The theme modifies the variant stylesheets during build and tries to store
-# them with the same file name. In certain installations it was observed, that
-# Hugo could not overwrite these files due to permission issues. If you
-# experience this, you can first try to set the `--noChmod` option for Hugo.
-# If this still doesn't help you can set this option to eg. ".gen". This will
-# be used as a suffix for these generated files, causing them to be newly
-# created instead of overwriting the existing ones.
-themeVariantModifier = ""
-
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# General
# These options are defining general, non visual behavior.
diff --git a/layouts/partials/get-theme-variants.hugo b/layouts/partials/get-theme-variants.hugo
index 55b1f88052..24e4f8ccc9 100644
--- a/layouts/partials/get-theme-variants.hugo
+++ b/layouts/partials/get-theme-variants.hugo
@@ -1,5 +1,4 @@
{{- $page := . }}
-{{- $mod := "" }}
{{- $autores := resources.Get "css/auto.css" }}
{{- $printres := resources.Get "css/format-print.css" }}
{{- $nonautothemevariants := slice }}
@@ -54,10 +53,10 @@ Auto run:
{{- $dark := index $themevariant.auto 1 | default (index $defaultautothemevariants 1) }}
{{- $themevariant = collections.Merge $themevariant (dict "auto" (slice | append $light | append $dark)) }}
{{- $refthemevariants = $refthemevariants | append $themevariant.auto }}
- {{- $cssres := $autores | resources.ExecuteAsTemplate (printf "css/theme-%s%s.css" $themevariant.identifier $mod) (dict "prefix" "theme" "suffix" $mod "light" $light "dark" $dark) }}
+ {{- $cssres := $autores | resources.ExecuteAsTemplate (printf "css/theme-%s.css" $themevariant.identifier) (dict "prefix" "theme" "light" $light "dark" $dark) }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}
{{- $themevariant = collections.Merge $themevariant (dict "chroma" $themevariant.identifier) }}
- {{- $cssres = $autores | resources.ExecuteAsTemplate (printf "css/chroma-%s.css" $themevariant.chroma) (dict "prefix" "chroma" "suffix" "" "light" $light "dark" $dark) }}
+ {{- $cssres = $autores | resources.ExecuteAsTemplate (printf "css/chroma-%s.css" $themevariant.chroma) (dict "prefix" "chroma" "light" $light "dark" $dark) }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}
{{- end }}
{{- $themevariants = $themevariants | append $themevariant }}
@@ -86,7 +85,7 @@ Non-auto run:
{{- range $tempthemevariant := $tempthemevariants }}
{{- $themevariant := $tempthemevariant }}
{{- if not (collections.IsSet $themevariant "auto") }}
- {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $themevariant.identifier "mod" $mod)}}
+ {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $themevariant.identifier)}}
{{- $cssres := resources.Get (printf "css/chroma-%s.css" $themevariant.chroma) }}
{{- if not $cssres }}
{{- errorf "\"chroma-%s.css\": file not found in \"assets/css\"; if you are migrating from a theme version older thant 6.0.0, you have to move it over from \"static/css\"" $themevariant.chroma }}
@@ -96,7 +95,7 @@ Non-auto run:
{{- $themevariants = $themevariants | append $themevariant }}
{{- end }}
-{{- $cssres := $printres | resources.ExecuteAsTemplate "css/format-print.css" (dict "themevariant" (index (collections.Where $themevariants "identifier" "relearn-light") 0) "mod" $mod) }}
+{{- $cssres := $printres | resources.ExecuteAsTemplate "css/format-print.css" (dict "themevariant" (index (collections.Where $themevariants "identifier" "relearn-light") 0)) }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}
{{- return collections.Where $themevariants "config" true }}
@@ -104,22 +103,20 @@ Non-auto run:
{{- define "partials/get-theme-details.html" }}
{{- $themevariant := .themevariant }}
{{- $identifier := .identifier }}
- {{- $mod := .mod }}
{{- $themecontent := "" }}
{{- with resources.Get (printf "css/theme-%s.css" $identifier) }}
{{- $themecontent = .Content }}
{{- else }}
{{- errorf "\"theme-%s.css\": file not found in \"assets/css\"; if you are migrating from a theme version older thant 6.0.0, you have to move it over from \"static/css\"" $identifier }}
{{- end }}
- {{- replaceRE (printf `([ \t]*@import\s+[^$]*?theme-[^.]*?)(?:%s)?(\.css)` (replace $mod "." "\\.")) (printf "${1}%s${2}" $mod) $themecontent }}
{{- $chroma := "" }}
{{- range findRESubmatch `[ \t]*@import\s+[^$]*?chroma-([^.]*?)\.css` $themecontent }}
{{- $chroma = index . 1 }}
{{- errorf "\"theme-%s.css\": UNSUPPORTED use of @import for chroma stylesheet, instead use '--CODE-theme: %s;'" $identifier $chroma }}
{{- end }}
- {{- range findRESubmatch (printf `[ \t]*@import\s+[^$]*?theme-([^.]*?)%s\.css` (replace $mod "." "\\.")) $themecontent }}
+ {{- range findRESubmatch `[ \t]*@import\s+[^$]*?theme-([^.]*?)\.css` $themecontent }}
{{- $subidentifier := index . 1 }}
- {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $subidentifier "mod" $mod) }}
+ {{- $themevariant = partial "get-theme-details.html" (dict "themevariant" $themevariant "identifier" $subidentifier) }}
{{- $chroma = $themevariant.chroma }}
{{- end }}
{{- range findRESubmatch `[ \t]*--CODE-theme\s*:\s*([^;]*?)\s*;` $themecontent }}
@@ -130,7 +127,7 @@ Non-auto run:
{{- $themecontent = replaceRE `(:root\s*\{[ \t]*)(\s*)` (printf "${1}${2}--CODE-theme: %s;${2}" $chroma) $themecontent }}
{{- end }}
{{- $themevariant = collections.Merge $themevariant (dict "chroma" $chroma) }}
- {{- $cssres := $themecontent | resources.FromString (printf "css/theme-%s%s.css" $identifier $mod) }}
+ {{- $cssres := $themecontent | resources.FromString (printf "css/theme-%s.css" $identifier) }}
{{- /* the following code causes Hugo to generate our css file - although it is in comments */}}
{{- return $themevariant }}
{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/stylesheet.html b/layouts/partials/stylesheet.html
index 20e388842c..61085c3a0b 100644
--- a/layouts/partials/stylesheet.html
+++ b/layouts/partials/stylesheet.html
@@ -14,9 +14,8 @@
{{- $themevariants := partialCached "get-theme-variants.hugo" . }}
- {{- $themevariantmodifier := .Site.Params.themeVariantModifier | default "" }}
{{- with index $themevariants 0 }}
-
+
{{- end }}
@@ -39,7 +38,6 @@
window.index_js_url={{ "index.search.js" | relLangURL }};
{{- end }}
{{ "// variant stuff" | safeJS }}
- window.relearn.themeVariantModifier='{{ $themevariantmodifier }}';
{{- $quotedthemevariants := slice }}
{{- range $themevariants }}
{{- $quotedthemevariants = $quotedthemevariants | append (printf "'%s'" .identifier) }}
diff --git a/static/js/variant.js b/static/js/variant.js
index 60f75dfaad..ddc82e4b5c 100644
--- a/static/js/variant.js
+++ b/static/js/variant.js
@@ -60,8 +60,7 @@ var variants = {
},
generateVariantPath: function( variant, old_path ){
- var mod = window.relearn.themeVariantModifier.replace( '.', '\\.' );
- var new_path = old_path.replace( new RegExp(`^(.*\/theme-).*?(${mod}\.css.*)$`), '$1' + variant + '$2' );
+ var new_path = old_path.replace( new RegExp(`^(.*\/theme-).*?(\.css.*)$`), '$1' + variant + '$2' );
return new_path;
},