mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-09 14:59:45 +00:00
Place custom css under assets
This commit is contained in:
parent
80c0c42f93
commit
452913c1fa
2 changed files with 9 additions and 7 deletions
|
@ -11,7 +11,7 @@ DefaultContentLanguage = "en" # Default language fo
|
|||
fadeIn = true # Turn on/off the fade-in effect
|
||||
dateFormat = "Jan 2, 2006"
|
||||
email = "youremail@email.com" # E-mail address for contact section
|
||||
# customCSS = ["foo.css"] # Include custom css files
|
||||
# customCSS = ["foo.css"] # Include custom css files placed under assets/
|
||||
|
||||
# Configure the home page
|
||||
[params.home]
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
{{ $file := "sass/style.sass" }}
|
||||
{{ $bundleRaw := resources.Get "sass/style.sass" | resources.ExecuteAsTemplate "style/main.tmp.css" . }}
|
||||
|
||||
{{ if .Site.IsServer }}
|
||||
{{ $cssOpts := (dict "targetPath" "styles/main.css" "enableSourceMap" true ) }}
|
||||
{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts }}
|
||||
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">
|
||||
{{ $bundle := $bundleRaw | toCSS $cssOpts }}
|
||||
<link rel="stylesheet" href="{{ $bundle.Permalink }}" media="screen">
|
||||
{{ else }}
|
||||
{{ $cssOpts := (dict "targetPath" "styles/main.css" ) }}
|
||||
{{ $postCSSOpts := (dict "use" "autoprefixer" ) }}
|
||||
{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
|
||||
{{ $bundle := $bundleRaw | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $bundle.Permalink }}" integrity="{{ $bundle.Data.Integrity }}" media="screen">
|
||||
{{ end }}
|
||||
|
||||
<!-- Custom css -->
|
||||
{{ range .Site.Params.customCSS -}}
|
||||
<link rel="stylesheet" href="{{ . | absURL }}">
|
||||
{{ $style := resources.Get . }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}" media="screen">
|
||||
{{- end }}
|
||||
|
|
Loading…
Reference in a new issue