diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-08-31 17:10:09 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-10-05 11:03:41 +0300 |
commit | 407143831f5fdb33728064164b8f3c2395244aef (patch) | |
tree | e29aa32843365306d749ef938246b359cbaaada9 | |
parent | 4da8870bdd6a16c819f7c1a41a82e6c50d9ddfb4 (diff) |
Upgade to Alpine v3alpine3
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | alpinejs/.gitignore | 1 | ||||
-rw-r--r-- | alpinejs/README.md | 11 | ||||
-rw-r--r-- | alpinejs/config.toml | 12 | ||||
-rw-r--r-- | alpinejs/go.mod | 9 | ||||
-rw-r--r-- | alpinejs/go.sum | 28 | ||||
-rw-r--r-- | alpinejs/layouts/partials/jslibs/alpinejs/script-src.html | 14 | ||||
-rw-r--r-- | alpinejs/layouts/partials/jslibs/alpinejs/v3/script-src.html | 4 | ||||
-rw-r--r-- | turbo/README.md | 24 | ||||
-rw-r--r-- | turbo/config.toml | 12 | ||||
-rw-r--r-- | turbo/go.mod | 5 | ||||
-rw-r--r-- | turbo/go.sum | 4 | ||||
-rw-r--r-- | turbo/layouts/partials/jslibs/turbo/script-src.html | 7 |
14 files changed, 97 insertions, 43 deletions
@@ -1 +1,2 @@ -**/resources
\ No newline at end of file +**/resources +public/
\ No newline at end of file @@ -9,12 +9,6 @@ Hugo has great support for [JavaScript building](https://gohugo.io/hugo-pipes/js * The dependencies can be vendored (`hugo mod vendor`) to make your site truly standalone. * ... -To use AlpineJS with Turbolinks you can just import the modules into your config and then add this to your `head` - -``` -{{ partialCached "jslibs/alpinejs/script-src.html" "-" }} -{{ partialCached "jslibs/turbolinks/script-src.html" "-" }} -``` See each component's README for usage. diff --git a/alpinejs/.gitignore b/alpinejs/.gitignore new file mode 100644 index 0000000..d298be1 --- /dev/null +++ b/alpinejs/.gitignore @@ -0,0 +1 @@ +public/
\ No newline at end of file diff --git a/alpinejs/README.md b/alpinejs/README.md index 866ae76..3a4bed5 100644 --- a/alpinejs/README.md +++ b/alpinejs/README.md @@ -11,22 +11,19 @@ First, add the module import to your site or theme component's configuration's m ```toml [module] [[imports]] -path = "github.com/gohugoio/hugo-mod-jslibs/alpinejs" +path = "github.com/gohugoio/hugo-mod-jslibs/alpinejs/v3" ``` +To use `v2` of AlpineJS, use the module path `github.com/gohugoio/hugo-mod-jslibs/alpinejs` + Then add the script source in the head section of your template (typically in the `baseof.html`): ```html <head> -{{ partialCached "jslibs/alpinejs/script-src.html" "-" }} +{{ partialCached "jslibs/alpinejs/v3/script-src.html" "-" }} </head> ``` -Note, if used with Turbolinks, the order matters: -```html -{{ partialCached "jslibs/alpinejs/script-src.html" "-" }} -{{ partialCached "jslibs/turbolinks/script-src.html" "-" }} -``` diff --git a/alpinejs/config.toml b/alpinejs/config.toml index a5030e9..4abdba2 100644 --- a/alpinejs/config.toml +++ b/alpinejs/config.toml @@ -3,13 +3,7 @@ source = "layouts" target = "layouts" [[module.imports]] -path = "github.com/alpinejs/alpine" +path = "github.com/bep/alpine/v3" [[module.imports.mounts]] -source = "dist" -target = "assets/jslibs/alpinejs" -[[module.imports]] -path = "github.com/SimoTod/alpine-turbolinks-adapter" -[[module.imports.mounts]] -source = "dist" -target = "assets/jslibs/alpinejs-turbolinks" - +source = "packages" +target = "assets/jslibs/alpinejs/v3" diff --git a/alpinejs/go.mod b/alpinejs/go.mod index 542de81..5e4cbb3 100644 --- a/alpinejs/go.mod +++ b/alpinejs/go.mod @@ -1,8 +1,5 @@ -module github.com/gohugoio/hugo-mod-jslibs/alpinejs +module github.com/gohugoio/hugo-mod-jslibs/alpinejs/v3 -go 1.13 +go 1.17 -require ( - github.com/SimoTod/alpine-turbolinks-adapter v1.0.2 // indirect - github.com/alpinejs/alpine v2.8.2+incompatible // indirect -) +require github.com/bep/alpine/v3 v3.2.5-0.20211005075525-13dd6f30a529 diff --git a/alpinejs/go.sum b/alpinejs/go.sum index 363b80d..dbbff08 100644 --- a/alpinejs/go.sum +++ b/alpinejs/go.sum @@ -14,3 +14,31 @@ github.com/alpinejs/alpine v2.8.0+incompatible h1:gSRM1X1MV+igNEKac7bBTGyaoO4uy+ github.com/alpinejs/alpine v2.8.0+incompatible/go.mod h1:BKI81egATMnaKqFeX5HEfYMnjZjcjcZmrYAu5Nck+EY= github.com/alpinejs/alpine v2.8.2+incompatible h1:WO8GLAdvObtsMH1h7bmURNk58OqkEltSpY10Y8sWRrw= github.com/alpinejs/alpine v2.8.2+incompatible/go.mod h1:BKI81egATMnaKqFeX5HEfYMnjZjcjcZmrYAu5Nck+EY= +github.com/alpinejs/alpine v3.2.4+incompatible h1:ydWmAiCFGEicsZ5GiK4EM9U0h2fAPX9OlFsscb4q4CQ= +github.com/alpinejs/alpine v3.2.4+incompatible/go.mod h1:BKI81egATMnaKqFeX5HEfYMnjZjcjcZmrYAu5Nck+EY= +github.com/bep/alpine v1.12.1-0.20210902103828-ddc997133ccb h1:jCKw+kbIeK5n5414tcbLB88s6Rc7Ur4F7g1mk+8sS/0= +github.com/bep/alpine v1.12.1-0.20210902103828-ddc997133ccb/go.mod h1:A1TyYXMIzqAGKxatqj6fUTfROR3FCkY4eIL58PHaM4I= +github.com/bep/alpine v1.12.1-0.20210902104424-0ecbaaa098fc h1:LagdfH+Eh5yRCNMt0PBFXWEw69b7TZhRQV7wejodgzU= +github.com/bep/alpine v1.12.1-0.20210902104424-0ecbaaa098fc/go.mod h1:A1TyYXMIzqAGKxatqj6fUTfROR3FCkY4eIL58PHaM4I= +github.com/bep/alpine v3.2.4+incompatible h1:aDD7X7gD4K2J8MV2Qy4ihlQHcBGu/okGzZus4317mvQ= +github.com/bep/alpine v3.2.4+incompatible/go.mod h1:SJKVVbmUVFXcP+dwsSUsgqMsdmzmGoyW6fQ/Lu2t/6s= +github.com/bep/alpine/v3 v3.2.5-0.20210902104719-ebe255f6cc1d h1:nDFgqRuwcPY/SwbWN/XpuCQxJmISLWP8M33JtW7E0Yk= +github.com/bep/alpine/v3 v3.2.5-0.20210902104719-ebe255f6cc1d/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/bep/alpine/v3 v3.2.5-0.20210909072824-e57ddbb5633e h1:jDkOGOjbWNmY3WxiQ7Rf9NPyzxiMaDA130soo9AiWs4= +github.com/bep/alpine/v3 v3.2.5-0.20210909072824-e57ddbb5633e/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/bep/alpine/v3 v3.2.5-0.20210914072428-20e998471b85 h1:NurCoY5e8z0ItldyjaI66SPQIFd1Pb5RgSJpT+2/swY= +github.com/bep/alpine/v3 v3.2.5-0.20210914072428-20e998471b85/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/bep/alpine/v3 v3.2.5-0.20210914075739-668379af38ea h1:LpkrwV81+3t4wNYxzAiRNuJzAY/z6PqJZ3bp6FAxn2o= +github.com/bep/alpine/v3 v3.2.5-0.20210914075739-668379af38ea/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/bep/alpine/v3 v3.2.5-0.20210917071850-b66c26bdcfbf h1:MUlCRVN3PMnHKsWCO+S3hvYUYTPJonqDFaXJ0PyCyFc= +github.com/bep/alpine/v3 v3.2.5-0.20210917071850-b66c26bdcfbf/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/bep/alpine/v3 v3.2.5-0.20210928081809-9fd8fd95a73c h1:+qgRJgvIKUH+wGAT7o3vebMD9s7SBneJ+JMmke6blUE= +github.com/bep/alpine/v3 v3.2.5-0.20210928081809-9fd8fd95a73c/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/bep/alpine/v3 v3.2.5-0.20210928163740-33a7c54cdd3d h1:sQL8cW4wkzshSI3LgkpbJCThj0x3fousS5wZCMwWkoI= +github.com/bep/alpine/v3 v3.2.5-0.20210928163740-33a7c54cdd3d/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/bep/alpine/v3 v3.2.5-0.20211005075525-13dd6f30a529 h1:eMF8e/OeJggvhkf94Sd/nN+w9tLf+Xwb1dr+H/vHtDs= +github.com/bep/alpine/v3 v3.2.5-0.20211005075525-13dd6f30a529/go.mod h1:0VhemIWFjjBCkWVQ2IcOwgrphy2JI2+q+Vq6+17wq2M= +github.com/vuejs/vue-next v3.0.2+incompatible h1:E8pORTa7zVeWrX3GxUNLK1QnnDh/SmRvc9KDahPpeF8= +github.com/vuejs/vue-next v3.0.2+incompatible/go.mod h1:ulo1XhaHAZB/k6wzZ6YaorEhSLNaoVQeLD/3heptfQQ= +github.com/vuejs/vue-next v3.2.6+incompatible h1:RsK3wlznUtSJ/TuQWcyc5outOjzmIzf+b4/SfmeD8xs= +github.com/vuejs/vue-next v3.2.6+incompatible/go.mod h1:ulo1XhaHAZB/k6wzZ6YaorEhSLNaoVQeLD/3heptfQQ= diff --git a/alpinejs/layouts/partials/jslibs/alpinejs/script-src.html b/alpinejs/layouts/partials/jslibs/alpinejs/script-src.html deleted file mode 100644 index 51f649c..0000000 --- a/alpinejs/layouts/partials/jslibs/alpinejs/script-src.html +++ /dev/null @@ -1,14 +0,0 @@ -{{- $isProd := hugo.IsProduction -}} -{{- $js := resources.Get "jslibs/alpinejs/alpine.js" -}} -{{- $js11 := resources.Get "jslibs/alpinejs/alpine-ie11.js" -}} -{{- $jsTurbolinksAdapter := resources.Get "jslibs/alpinejs-turbolinks/alpine-turbo-drive-adapter.js" -}} -{{- $js = slice $jsTurbolinksAdapter $js | resources.Concat "jslibs/alpinejs/alpine.js" -}} -{{- $js11 = slice $jsTurbolinksAdapter $js11 | resources.Concat "jslibs/alpinejs/alpine-ie11.js" -}} -{{- if $isProd }} - {{ $js = $js | minify | fingerprint }} -{{ end -}} -{{- if $isProd }} - {{ $js11 = $js11 | minify | fingerprint }} -{{ end -}} -<script type="module" src="{{ $js.RelPermalink }}" {{ if $isProd }} integrity="{{ $js.Data.Integrity }}" {{ end }}></script> -<script nomodule src="{{ $js11.RelPermalink }}" {{ if $isProd }} integrity="{{ $js11.Data.Integrity }}" {{ end }} defer></script>
\ No newline at end of file diff --git a/alpinejs/layouts/partials/jslibs/alpinejs/v3/script-src.html b/alpinejs/layouts/partials/jslibs/alpinejs/v3/script-src.html new file mode 100644 index 0000000..bfc119c --- /dev/null +++ b/alpinejs/layouts/partials/jslibs/alpinejs/v3/script-src.html @@ -0,0 +1,4 @@ +{{ $sourceMap := cond hugo.IsProduction "" "inline" }} +{{ $opts := dict "sourceMap" $sourceMap "minify" hugo.IsProduction "target" "es2016" }} +{{- $js := resources.Get "alpinejs/dist/cdn.js" | js.Build $opts -}} +<script src="{{ $js.RelPermalink }}" {{ if hugo.IsProduction }} integrity="{{ $js.Data.Integrity }}" {{ end }}defer></script> diff --git a/turbo/README.md b/turbo/README.md new file mode 100644 index 0000000..7d75e07 --- /dev/null +++ b/turbo/README.md @@ -0,0 +1,24 @@ +## Description + +This module wraps [Turbo](https://github.com/hotwired/turbo). + +## Installation + +First, add the module import to your site or theme component's configuration's module section: + +```toml +[module] +[[imports]] +path = "github.com/gohugoio/hugo-mod-jslibs/turbo" +``` + +Then add the script source in the head section of your template (typically in the `baseof.html`): + + +```html +<head> +{{ partialCached "jslibs/turbo/script-src.html" "-" }} +</head> +``` + +Note that the target `src` folder gets mounted to `assets/jslibs/turbo`.
\ No newline at end of file diff --git a/turbo/config.toml b/turbo/config.toml new file mode 100644 index 0000000..73515d5 --- /dev/null +++ b/turbo/config.toml @@ -0,0 +1,12 @@ +[module] +[[module.mounts]] +source = "layouts" +target = "layouts" +[[module.mounts]] +source = "assets" +target = "assets" +[[module.imports]] +path = "github.com/hotwired/turbo" +[[module.imports.mounts]] +source = "src" +target = "assets/jslibs/turbo" diff --git a/turbo/go.mod b/turbo/go.mod new file mode 100644 index 0000000..d36cd4a --- /dev/null +++ b/turbo/go.mod @@ -0,0 +1,5 @@ +module github.com/gohugoio/hugo-mod-jslibs/turbo + +go 1.17 + +require github.com/hotwired/turbo v7.0.1+incompatible // indirect diff --git a/turbo/go.sum b/turbo/go.sum new file mode 100644 index 0000000..8e31738 --- /dev/null +++ b/turbo/go.sum @@ -0,0 +1,4 @@ +github.com/hotwired/turbo v7.0.1+incompatible h1:DvY56vNgcvH0vkw4VqlAc/hfsTeMdcoOKTGgnoGH6ok= +github.com/hotwired/turbo v7.0.1+incompatible/go.mod h1:6XcpYEC+j8xb7URpSYwhlq4iq98M5F5T/jaLWNHVbZs= +github.com/turbolinks/turbolinks-source-gem v5.2.0+incompatible h1:UNx8t3fYB51UyUv3gOXpTPT7Q6u9LCdcXQd2iW1EClA= +github.com/turbolinks/turbolinks-source-gem v5.2.0+incompatible/go.mod h1:Cl0Br9tUXkQvxumVNGTvyaa7dqpFC2kPMrsS0Ttc94U= diff --git a/turbo/layouts/partials/jslibs/turbo/script-src.html b/turbo/layouts/partials/jslibs/turbo/script-src.html new file mode 100644 index 0000000..e274abe --- /dev/null +++ b/turbo/layouts/partials/jslibs/turbo/script-src.html @@ -0,0 +1,7 @@ +{{ $sourceMap := cond hugo.IsProduction "" "inline" }} +{{ $opts := dict "sourceMap" $sourceMap "minify" hugo.IsProduction "target" "es2016" }} +{{- $js := resources.Get "jslibs/turbo/index.ts" | js.Build $opts -}} +{{- if hugo.IsProduction }} + {{ $js = $js | fingerprint }} +{{ end -}} +<script src="{{ $js.RelPermalink }}" {{ if hugo.IsProduction }} integrity="{{ $js.Data.Integrity }}" {{ end }} defer></script>
\ No newline at end of file |