hugo-theme-introduction/layouts/partials/head/css.html
Robert J 9b49548467 CORS and Polish lang (#126)
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.
2019-01-25 15:31:09 +01:00

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 }}