From 6493bdde05b6b20a9f87e4e7977dd280306763e8 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 22 Nov 2020 15:23:56 +0100 Subject: [PATCH] hash css/js assets by default --- .tarignore | 4 +++- CHANGELOG.md | 15 +++------------ gulpfile.js | 13 ++++++++----- src/sass/_base.scss | 2 +- static/assets.json | 8 -------- 5 files changed, 15 insertions(+), 27 deletions(-) delete mode 100644 static/assets.json diff --git a/.tarignore b/.tarignore index 366a510..2c79ca3 100644 --- a/.tarignore +++ b/.tarignore @@ -11,4 +11,6 @@ node* local* dist src -tmp +build +renovate* +resources diff --git a/CHANGELOG.md b/CHANGELOG.md index 457f841..2185b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,5 @@ - ENHANCEMENT - - add node `gulp` script to package.json - - remove `title` and set empty `alt` tag on branding image - - add minimal working css for printing - - split out mobile css - load static css/js assets from data template: - This way users can hash static assets and overwrite the data template - to deliver the hashed assets. Thats helpful if you have to deal with - long cache settings but wont to ensure your updated assets are delivered - to clients. -- BUGFIX - - use relative URL's for fonts -- INTERNAL - - publish Lighthouse CI overwiew to PR's + Build-in assets are now hashed by default. The static assets are located + in the `assests` directory. The theme will read and use tha hashed files + from `data/assets.json`. Exception: `custom.css` will be used unhashed. diff --git a/gulpfile.js b/gulpfile.js index 59501c0..c1cd94e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,11 +4,11 @@ const sass = require("gulp-sass"); const cleanCSS = require("gulp-clean-css"); const autoprefixer = require("gulp-autoprefixer"); const iconfont = require("gulp-iconfont"); +const clean = require("gulp-clean"); const realFavicon = require("gulp-real-favicon"); const path = require("path"); const fs = require("fs"); -const del = require("del"); const svgSprite = require("gulp-svg-sprite"); const rev = require("gulp-rev"); @@ -203,17 +203,20 @@ gulp.task("asset-rev", function () { gulp.task("asset-rm", function () { return gulp - .src(["build/assets", "static/js/*-*.js", "static/*-*.js"], { read: false }) + .src(["build/assets", "static/js/*-*.js", "static/*-*.css"], { + read: false, + allowEmpty: true, + }) .pipe(clean()); }); +gulp.task("asset", gulp.series("asset-rm", "asset-rev")); + gulp.task( "default", - gulp.series("sass", "svg-sprite", "iconfont", "favicon-generate", "asset-rev") + gulp.series("sass", "svg-sprite", "iconfont", "favicon-generate", "asset") ); -gulp.task("asset", gulp.series("asset-rev", "asset-rm")); - gulp.task("devel", function () { gulp.watch("src/sass/**/*.*css", gulp.series("sass", "asset")); }); diff --git a/src/sass/_base.scss b/src/sass/_base.scss index b37c231..bce324c 100644 --- a/src/sass/_base.scss +++ b/src/sass/_base.scss @@ -1,5 +1,5 @@ html { - font-size: 3rem; + font-size: $font-size-base; letter-spacing: 0.33px; scroll-behavior: smooth; } diff --git a/static/assets.json b/static/assets.json deleted file mode 100644 index ccec2ab..0000000 --- a/static/assets.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "custom.css": "custom.css", - "js/clipboard.min.js": "js/clipboard-f06c52bfdd.min.js", - "js/mermaid.min.js": "js/mermaid-ffd6bf77ad.min.js", - "main.min.css": "main-85732d8853.min.css", - "mobile.min.css": "mobile-dc4707ee5b.min.css", - "print.min.css": "print-86167e859a.min.css" -} \ No newline at end of file