From dea0962f7cfe2a74a758251912be22082749e07a Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 2 Aug 2018 14:54:07 -0400 Subject: [PATCH] Use flask-webassets to version js/css bundle --- atst/assets.py | 12 ++++++++---- package.json | 2 +- templates/base.html | 8 ++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/atst/assets.py b/atst/assets.py index aef6b35e..6c8fd7e8 100644 --- a/atst/assets.py +++ b/atst/assets.py @@ -4,10 +4,14 @@ from atst.home import home environment = Environment() css = Bundle( - "../scss/atat.scss", - filters="scss", - output="../static/assets/out.%(version)s.css", - depends=("**/*.scss"), + "../static/assets/index.css", + output="../static/assets/styles.%(version)s.css", ) environment.register("css", css) + +js = Bundle( + '../static/assets/index.js', + output='../static/assets/index.%(version)s.js' +) +environment.register('js_all', js) diff --git a/package.json b/package.json index 4d7b794e..421c767b 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "watch": "parcel watch static/js/index.js -d static/assets -o index.js --no-autoinstall", - "build": "parcel build static/js/index.js -d static/assets -o index.js --no-autoinstall", + "build": "parcel build static/js/index.js -d static/assets -o index.js", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", diff --git a/templates/base.html b/templates/base.html index aaae0374..acc3e6e7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -8,7 +8,9 @@ {% block title %}JEDI{% endblock %} - + {% assets "css" %} + + {% endassets %} @@ -32,6 +34,8 @@ {% include 'footer.html' %} {% block modal %}{% endblock %} - + {% assets "js_all" %} +