8000 Add option to pass params to scss files · Issue #4 · thuliteio/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add option to pass params to scss files #4
Open
@h-enk

Description

@h-enk

Update libsass.html — create resource from template with ExecuteAsTemplate:

{{ $css := "" }}
{{ if eq (hugo.Environment) "development" -}}
  {{ $options := (dict "targetPath" "main.css" "transpiler" "libsass" "enableSourceMap" true "includePaths" (slice "node_modules")) -}}
  {{ $css = resources.Get . | resources.ExecuteAsTemplate "app.scss" . | toCSS $options | resources.Fingerprint "sha512" -}}
{{ else -}}
  {{ $options := (dict "targetPath" "main.css" "transpiler" "libsass" "outputStyle" "compressed" "includePaths" (slice "node_modules")) -}}
  {{ $css = resources.Get . | resources.ExecuteAsTemplate "app.scss" . | toCSS $options | postCSS (dict "config" "config/postcss.config.js") | resources.Fingerprint "sha512" -}}
{{ end -}}
<link rel="stylesheet" href="{{ $css.Permalink | relURL }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous">

Example

In config\_default\hyas\starter.toml:

[..]
# SCSS
backGround = "yellowgreen"

In assets\scss\app.scss:

[..]
body {
  background-color: {{ site.Data.starter.backGround }};
}
[..]

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0