mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-14 00:59:43 +00:00
9b49548467
I propose adding `crossorigin=anonymous` for signed stylesheets to allow for CORS policy. Practical example - I keep my web page in S3 bucket and redirect both naked domain and www domain into the same bucket (this is rare scenario - most people duplicate buckets). So I had to enable CORS like in [this article](https://medium.com/@Keithweaver_/only-allowing-access-to-your-s3-bucket-via-your-website-5ca5c8546152) However CORS cannot be used without crossorigin=anonymous set. (explained [here](https://stackoverflow.com/questions/32039568/what-are-the-integrity-and-crossorigin-attributes) Also added pl.toml for Polish language.
18 lines
917 B
HTML
18 lines
917 B
HTML
{{ $bundleRaw := resources.Get "/sass/style.sass" | resources.ExecuteAsTemplate "/css/main.tmp.css" . }}
|
|
|
|
{{ if .Site.IsServer }}
|
|
{{ $cssOpts := (dict "targetPath" "/css/main.css" "enableSourceMap" true ) }}
|
|
{{ $bundle := $bundleRaw | toCSS $cssOpts }}
|
|
<link rel="stylesheet" href="{{ $bundle.Permalink }}" media="screen">
|
|
{{ else }}
|
|
{{ $cssOpts := (dict "targetPath" "/css/main.css" ) }}
|
|
{{ $postCSSOpts := (dict "use" "autoprefixer" ) }}
|
|
{{ $bundle := $bundleRaw | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }}
|
|
<link rel="stylesheet" href="{{ $bundle.Permalink }}" integrity="{{ $bundle.Data.Integrity }}" crossorigin="anonymous" media="screen">
|
|
{{ end }}
|
|
|
|
<!-- Custom css -->
|
|
{{ range .Site.Params.customCSS -}}
|
|
{{ $style := resources.Get . }}
|
|
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}" crossorigin="anonymous" media="screen">
|
|
{{- end }}
|