diff options
author | Sebastian Pech <windows@spech.de> | 2020-05-10 12:52:45 +0300 |
---|---|---|
committer | Sebastian Pech <windows@spech.de> | 2020-05-10 12:52:45 +0300 |
commit | aea3c7c77e0ac484ae950a2015593599699266b8 (patch) | |
tree | 2db7c8b735797ab44d6a0484469adb4064dccb63 | |
parent | fabb8570b87a10f08e406a8424372acdba605588 (diff) |
jscdn, csscdn extended
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | layouts/partials/head.html | 4 | ||||
-rw-r--r-- | layouts/partials/js.html | 8 |
3 files changed, 17 insertions, 0 deletions
@@ -249,6 +249,7 @@ The second way is using the Site configuration or the post metadata to target sp ```toml [params] js=["/js/test_site.js"] + jscdn=["https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"] css=["/css/test_site.css"] csscdn=["https://fonts.googleapis.com/css?family=Roboto&display=swap"] ``` @@ -257,7 +258,11 @@ The second way is using the Site configuration or the post metadata to target sp --- js: - /js/test.js +jscdn: + - https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js css: - /css/test.css +csscdn: + - https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900 --- ``` diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 3a75478..2965065 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -29,6 +29,10 @@ <link rel="stylesheet" href="{{ . }}"> {{- end }} +{{- range .Params.csscdn }} + <link rel="stylesheet" href="{{ . }}"> +{{- end }} + {{- range .Site.Params.css }} {{ $pagestyle := resources.Get . | minify | fingerprint "sha512" }} <link rel="stylesheet" href="{{ $pagestyle.RelPermalink }}" integrity="{{ $pagestyle.Data.Integrity }}"> diff --git a/layouts/partials/js.html b/layouts/partials/js.html index 0aa07ec..5edcf02 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -4,6 +4,14 @@ {{ $allscript := slice $jquery $bootstrap $customjs | resources.Concat "/js/vendor.js" | minify | fingerprint "sha512" }} <script src="{{ $allscript.RelPermalink }}" integrity="{{ $allscript.Data.Integrity }}"></script> +{{- range .Site.Params.jscdn }} + <script src="{{ . }}"></script> +{{- end }} + +{{- range .Params.jscdn }} + <script src="{{ . }}"></script> +{{- end }} + {{- range .Site.Params.js }} {{ $pagescript := resources.Get . | minify | fingerprint "sha512" }} <script src="{{ $pagescript.RelPermalink }}" integrity="{{ $pagescript.Data.Integrity }}"></script> |