Skip to content

Commit

Permalink
fix: build without any module scoped preview styles (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Jan 26, 2024
1 parent 5911947 commit ada28f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assets/decap-cms/init.js.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
{{/* Register preview styles. */}}
{{- $css := resources.Get "decap-cms/scss/index.scss.tmpl" | resources.ExecuteAsTemplate "decap-cms/scss/index.scss" $ctx }}
{{- $css = $css | toCSS (dict "targetPath" "css/decap-cms.css" "outputStyle" (cond hugo.IsProduction "compressed" "")) }}
{{- $css = slice $css }}
{{- range $name, $partial := default slice site.Params.decap_cms._preview_style_partials }}
{{- if not $partial.path }}
{{- errorf "[decap-cms] preview style partial %q's %q is required." $name "path" }}
{{- else if not (printf "partials/%s.html" $partial.path | templates.Exists) }}
{{- errorf "[decap-cms] preview style partial %q does not exist: partials/%s.html." $name $partial.path }}
{{- else }}
{{- $css = slice $css | append (partial $partial.path $ctx) }}
{{- $css = $css | append (partial $partial.path $ctx) }}
{{- end }}
{{- end }}
{{- $css = $css | resources.Concat "css/decap-cms.css" | fingerprint }}
Expand Down

0 comments on commit ada28f6

Please sign in to comment.