From 2ab2765363bfc4bae1078364bd4989b9ad76d4d7 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 25 Aug 2021 19:36:37 +0200 Subject: [PATCH] Add jquery --- layouts/_default/baseof.html | 1 + layouts/partials/script.html | 9 +++++++++ package-lock.json | 13 ++++++++++++- package.json | 3 ++- scripts/build.sh | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/script.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 378fa92..7a92f0b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -13,6 +13,7 @@ {{ block "main" . }}{{ end }} {{ partial "footer.html" . }} + {{ partial "script.html" "js/jquery.min.js" }} {{ partial "script_async.html" "js/bootstrap.min.js" }} {{ block "scripts_extra" . }}{{ end }} diff --git a/layouts/partials/script.html b/layouts/partials/script.html new file mode 100644 index 0000000..9be13e8 --- /dev/null +++ b/layouts/partials/script.html @@ -0,0 +1,9 @@ +{{ $script := resources.Get . }} + +{{ if in . "min" }} + {{ $script = $script | minify | fingerprint }} +{{ else }} + {{ $script = $script | js.Build (dict "minify" true) | fingerprint }} +{{ end }} + + diff --git a/package-lock.json b/package-lock.json index 63c29f7..1655933 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,8 @@ "": { "dependencies": { "@fortawesome/fontawesome-free": "^5.15.4", - "bootstrap": "^5.1.0" + "bootstrap": "^5.1.0", + "jquery": "^3.6.0" } }, "node_modules/@fortawesome/fontawesome-free": { @@ -39,6 +40,11 @@ "peerDependencies": { "@popperjs/core": "^2.9.3" } + }, + "node_modules/jquery": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" } }, "dependencies": { @@ -58,6 +64,11 @@ "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.0.tgz", "integrity": "sha512-bs74WNI9BgBo3cEovmdMHikSKoXnDgA6VQjJ7TyTotU6L7d41ZyCEEelPwkYEzsG/Zjv3ie9IE3EMAje0W9Xew==", "requires": {} + }, + "jquery": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" } } } diff --git a/package.json b/package.json index 5aea04f..a2da78c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "dependencies": { "@fortawesome/fontawesome-free": "^5.15.4", - "bootstrap": "^5.1.0" + "bootstrap": "^5.1.0", + "jquery": "^3.6.0" } } diff --git a/scripts/build.sh b/scripts/build.sh index 23d3024..6a26839 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -11,6 +11,7 @@ mkdir -p "$STATIC_BUILD/img" mkdir -p "$STATIC_BUILD/js" # cp -r "$STATIC_SRC/js"/* "$STATIC_BUILD/js" +cp $BASEDIR/node_modules/jquery/dist/jquery.min.js $STATIC_BUILD/js/jquery.min.js cp $BASEDIR/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js $STATIC_BUILD/js/bootstrap.min.js mkdir -p "$STATIC_BUILD/css"