Remove custom generatesri tooling

We are now using Hugo's built in SRI support, which is magical and
seamless, and also gives us the bonus of acting as a cache buster.
This commit is contained in:
Alan Orth 2020-01-23 19:40:49 +02:00
parent 44e8c677a6
commit c41364cf19
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
4 changed files with 1 additions and 35 deletions

View File

@ -1,6 +0,0 @@
{
"style": "static/css/style.css",
"stylertl": "static/css/style.rtl.css",
"cookieconsentcss": "static/css/cookieconsent.min.css",
"cookieconsentjs": "static/js/cookieconsent.min.js"
}

View File

@ -1,23 +0,0 @@
// Adapted from: https://gist.github.com/jmervine/ae1bace0fe37dce75b90ec3e9592771c
var crypto = require('crypto');
var fs = require('fs');
var assets = require('./assets.json');
var generate384 = function (file) {
var enc = 'utf8';
var body = fs.readFileSync(file, { encoding: enc });
var hash = crypto.createHash('sha384').update(body, enc);
var sha = hash.digest('base64');
return 'sha384-' + sha;
}
for (var asset in assets) {
var path = assets[asset];
var hash = generate384(path);
console.log(asset + ' = "' + hash + '"');
}
// vim: set ts=2 sw=2 et:

View File

@ -1,4 +0,0 @@
style = "sha384-VTnwhtR+JhLMCVtk6TN2otzmRYQRc5nPgEiArZGlKz5HJf4QemM0F3Ya4AcORVmv"
stylertl = "sha384-oQ4oNesj6bITy7Qily3yrPXsgD2sHl+RtRg+yJxQuiZW/47RHd5tThkN5RK9U1cC"
cookieconsentcss = "sha384-6iYDyQZuuNT7DcPJGXx241czdv2+GDGUcXRiqw1iXrjgYMTorSetxFP3JCMQMwnR"
cookieconsentjs = "sha384-PDjg2ZdS3khPzd53i18+7tzB32JVQfFMrTXYo21RqPgUmEVAPwIhxOUF/8sP79CS"

View File

@ -11,8 +11,7 @@
"build:ltrcss": "rtlcss -s assets/css/style.css.tmp assets/css/style.rtl.css.tmp && cleancss --level 1 assets/css/style.rtl.css.tmp -o assets/css/style.rtl.css",
"build:fonts": "cp node_modules/font-awesome/fonts/* static/fonts",
"build:cookieconsent": "cp node_modules/cookieconsent/build/cookieconsent.min.css assets/css && cp node_modules/cookieconsent/build/cookieconsent.min.js assets/js",
"build:generatesri": "node build/sri.js > data/sri.toml",
"build": "npm run build:css && npm run build:ltrcss && npm run build:fonts && npm run build:cookieconsent && npm run build:generatesri && npm run clean",
"build": "npm run build:css && npm run build:ltrcss && npm run build:fonts && npm run build:cookieconsent && npm run clean",
"clean": "rm assets/css/style.css.tmp assets/css/style.rtl.css.tmp"
},
"keywords": "hugo",