hash css/js assets by default

This commit is contained in:
Robert Kaussow 2020-11-22 15:23:56 +01:00
parent a28863decf
commit 6493bdde05
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
5 changed files with 15 additions and 27 deletions

View File

@ -11,4 +11,6 @@ node*
local* local*
dist dist
src src
tmp build
renovate*
resources

View File

@ -1,14 +1,5 @@
- ENHANCEMENT - 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: - load static css/js assets from data template:
This way users can hash static assets and overwrite the data template Build-in assets are now hashed by default. The static assets are located
to deliver the hashed assets. Thats helpful if you have to deal with in the `assests` directory. The theme will read and use tha hashed files
long cache settings but wont to ensure your updated assets are delivered from `data/assets.json`. Exception: `custom.css` will be used unhashed.
to clients.
- BUGFIX
- use relative URL's for fonts
- INTERNAL
- publish Lighthouse CI overwiew to PR's

View File

@ -4,11 +4,11 @@ const sass = require("gulp-sass");
const cleanCSS = require("gulp-clean-css"); const cleanCSS = require("gulp-clean-css");
const autoprefixer = require("gulp-autoprefixer"); const autoprefixer = require("gulp-autoprefixer");
const iconfont = require("gulp-iconfont"); const iconfont = require("gulp-iconfont");
const clean = require("gulp-clean");
const realFavicon = require("gulp-real-favicon"); const realFavicon = require("gulp-real-favicon");
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const del = require("del");
const svgSprite = require("gulp-svg-sprite"); const svgSprite = require("gulp-svg-sprite");
const rev = require("gulp-rev"); const rev = require("gulp-rev");
@ -203,17 +203,20 @@ gulp.task("asset-rev", function () {
gulp.task("asset-rm", function () { gulp.task("asset-rm", function () {
return gulp 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()); .pipe(clean());
}); });
gulp.task("asset", gulp.series("asset-rm", "asset-rev"));
gulp.task( gulp.task(
"default", "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.task("devel", function () {
gulp.watch("src/sass/**/*.*css", gulp.series("sass", "asset")); gulp.watch("src/sass/**/*.*css", gulp.series("sass", "asset"));
}); });

View File

@ -1,5 +1,5 @@
html { html {
font-size: 3rem; font-size: $font-size-base;
letter-spacing: 0.33px; letter-spacing: 0.33px;
scroll-behavior: smooth; scroll-behavior: smooth;
} }

View File

@ -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"
}