From 3e98bd1af85ec136b4f0d03a8c69479b75f79d0e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 15 Aug 2018 19:51:15 +0100 Subject: [PATCH] Don't bundle all JS into 1 --- .eslintrc | 4 ++-- layouts/_default/baseof.html | 5 ++++- scripts/build.sh | 6 ++++++ static/src/js/index.js | 5 ----- static/src/js/jquery-global.js | 10 ---------- 5 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 static/src/js/jquery-global.js diff --git a/.eslintrc b/.eslintrc index 2cad660..1231b1b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,7 +4,7 @@ "dabapps/browser" ], "globals": { - "mermaid": true - + "mermaid": true, + "$": true } } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 28233a4..99486db 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -21,8 +21,11 @@ {{ partial "footer.html" . }} + + + + - diff --git a/scripts/build.sh b/scripts/build.sh index bd95b04..5d3b5df 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -12,6 +12,12 @@ hugo gen chromastyles --style=tango > $STATIC_SRC/scss/highlight.css cp -r $BASEDIR/node_modules/lightgallery/dist/fonts $STATIC_BUILD cp -r $STATIC_SRC/img $STATIC_BUILD/img cp -r $BASEDIR/node_modules/lightgallery/dist/img/* $STATIC_BUILD/img + +cp -r $BASEDIR/node_modules/jquery/dist/jquery.min.js $STATIC_BUILD/js/jquery.min.js +cp -r $BASEDIR/node_modules/lightgallery/dist/js/lightgallery.js $STATIC_BUILD/js/lightgallery.js +cp -r $BASEDIR/node_modules/lg-thumbnail/dist/lg-thumbnail.min.js $STATIC_BUILD/js/lg-thumbnail.min.js +cp -r $BASEDIR/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js $STATIC_BUILD/js/bootstrap.min.js + parcel build $STATIC_SRC/js/index.js -d $STATIC_BUILD/js/ -o app.js node-sass $STATIC_SRC/scss/style.scss $STATIC_BUILD/css/style.css --source-map-embed cp $BASEDIR/node_modules/mermaid/dist/mermaid.min.js $STATIC_BUILD/js/mermaid.min.js diff --git a/static/src/js/index.js b/static/src/js/index.js index 187aeb1..bef6acd 100644 --- a/static/src/js/index.js +++ b/static/src/js/index.js @@ -1,11 +1,6 @@ 'use strict'; -var $ = require('./jquery-global'); require('./fa'); -require('bootstrap'); - -require('lightgallery/dist/js/lightgallery'); -require('lg-thumbnail/dist/lg-thumbnail'); var Clipboard = require('clipboard'); diff --git a/static/src/js/jquery-global.js b/static/src/js/jquery-global.js deleted file mode 100644 index 4a31748..0000000 --- a/static/src/js/jquery-global.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var jQuery = require('jquery'); - -window.$ = jQuery; -window.jQuery = jQuery; -global.$ = jQuery; -global.jQuery = jQuery; - -module.exports = jQuery;