diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-10-06 18:20:16 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-10-06 18:20:16 +0300 |
commit | 3e00795644ec2d28c54d04c18b11b65406ae2357 (patch) | |
tree | d784008926b53dcf558140356e27d1d78cd05be6 | |
parent | e56f83a2ccbb13bc93d669cb55da2246b5715db7 (diff) |
alpinejs: Add a mount and some README
-rw-r--r-- | README.md | 31 | ||||
-rw-r--r-- | alpinejs/config.toml | 4 |
2 files changed, 35 insertions, 0 deletions
@@ -1,2 +1,33 @@ # hugo-mod-jslibs-dist + Thin Hugo Module wrappers around some popular JS libs' distribution source code. + +The `packages` folder is mounted in `assets/jslibs/alpinejs/v3`. + +That means that you can just import it into your Hugo config: + +```toml +[[module.imports]] +path = "github.com/gohugoio/hugo-mod-jslibs-dist/alpinejs/v3" +``` + +And then use it in your JS files: + +```js +import Alpine from 'jslibs/alpinejs/v3/alpinejs/dist/module.esm.js'; +import intersect from 'jslibs/alpinejs/v3/intersect/dist/module.esm.js'; +import persist from 'jslibs/alpinejs/v3/persist/dist/module.esm.js'; + +// Set up and start Alpine. +(function() { + // Register AlpineJS plugins. + Alpine.plugin(intersect); + Alpine.plugin(persist); + + // Start Alpine. + Alpine.start(); + +})(); + +``` + diff --git a/alpinejs/config.toml b/alpinejs/config.toml new file mode 100644 index 0000000..ae22a01 --- /dev/null +++ b/alpinejs/config.toml @@ -0,0 +1,4 @@ +[module] +[[module.mounts]] +source = "packages" +target = "assets/jslibs/alpinejs/v3" |