Move alpine.js from CDN to bundle (#14)

This commit is contained in:
Ondřej 2022-10-23 23:38:05 +02:00
parent fbf0e6d82a
commit 6354a2fc09
4 changed files with 36 additions and 3 deletions

7
assets/main.js Normal file
View file

@ -0,0 +1,7 @@
import Alpine from "alpinejs";
import persist from "@alpinejs/persist";
window.Alpine = Alpine;
Alpine.plugin(persist);
Alpine.start();

View file

@ -1,2 +1,2 @@
<script defer src="https://unpkg.com/@alpinejs/persist@3.x.x/dist/cdn.min.js"></script>
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
{{- $js := resources.Get "main.js" | js.Build | resources.Minify | fingerprint -}}
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" defer></script>

View file

@ -6,9 +6,11 @@
"author": "ondrej <ondrej@nyv.lt>",
"license": "MIT",
"scripts": {
"styles:watch": "npx tailwindcss -i ./assets/main.css -o ./assets/style.css --watch"
"styles:watch": "tailwindcss -i ./assets/main.css -o ./assets/style.css --watch"
},
"dependencies": {
"@alpinejs/persist": "^3.10.4",
"alpinejs": "^3.10.4",
"tailwindcss": "^3.2.0"
}
}

View file

@ -2,6 +2,11 @@
# yarn lockfile v1
"@alpinejs/persist@^3.10.4":
version "3.10.4"
resolved "https://registry.yarnpkg.com/@alpinejs/persist/-/persist-3.10.4.tgz#f2db4d64db88ad3bf938e5397b6c05f7b5d7a10f"
integrity sha512-u3e/QFbMyD11foO3H5TfqKXR890Q+CmWT0tl0Fc69xwGUuJt6o9xjKQcj8cP+S01CgTS/DdM9hXx/v5Y7nglCQ==
"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
@ -23,6 +28,18 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
"@vue/reactivity@~3.1.1":
version "3.1.5"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.1.5.tgz#dbec4d9557f7c8f25c2635db1e23a78a729eb991"
integrity sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==
dependencies:
"@vue/shared" "3.1.5"
"@vue/shared@3.1.5":
version "3.1.5"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.1.5.tgz#74ee3aad995d0a3996a6bb9533d4d280514ede03"
integrity sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==
acorn-node@^1.8.2:
version "1.8.2"
resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8"
@ -42,6 +59,13 @@ acorn@^7.0.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
alpinejs@^3.10.4:
version "3.10.4"
resolved "https://registry.yarnpkg.com/alpinejs/-/alpinejs-3.10.4.tgz#61bbadb2275796f545c4f53743f0bcbefa4661d0"
integrity sha512-AC6Xchlb/xURO7F93OSMItooClpzGNZRM5+rDa6/3Y20mPxQs1TQ/wfiwiH4mtcVt8yTxdkOW5dOl8CBCK095A==
dependencies:
"@vue/reactivity" "~3.1.1"
anymatch@~3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"