added more compression tools
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c08ebac8aa
commit
121e4d8e24
2 changed files with 38 additions and 2 deletions
32
.compress-all.js
Normal file
32
.compress-all.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
const glob = require("glob");
|
||||
const minify = require('@node-minify/core');
|
||||
const htmlMinifier = require('@node-minify/html-minifier');
|
||||
const crass = require('@node-minify/crass');
|
||||
|
||||
console.log('compress all html and css files');
|
||||
|
||||
glob("dist/**/*.html", function (er, files) {
|
||||
files.forEach(file => {
|
||||
console.log(file);
|
||||
minify({
|
||||
compressor: htmlMinifier,
|
||||
input: file,
|
||||
output: file,
|
||||
options: {
|
||||
collapseWhitespace: true,
|
||||
conservativeCollapse: true
|
||||
},
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
glob("dist/**/*.css", function (er, files) {
|
||||
files.forEach(file => {
|
||||
console.log(file);
|
||||
minify({
|
||||
compressor: crass,
|
||||
input: file,
|
||||
output: file
|
||||
});
|
||||
})
|
||||
});
|
|
@ -4,12 +4,11 @@
|
|||
"description": "website for sp-codes.de",
|
||||
"scripts": {
|
||||
"compile-sass": "node-sass --output-style compressed --importer=node_modules/node-sass-tilde-importer src/scss/main.scss -o dist/css/",
|
||||
"p-minify-css": "purifycss dist/css/main.css dist/**/*.html dist/**/**/*.html dist/**/**/**/*.html -i -m -o dist/css/main.css",
|
||||
"minify-css": "uncss -n -H dist/ -o dist/css/main.css dist/**/*.html dist/**/**/*.html dist/**/**/**/*.html",
|
||||
"watch:eleventy": "eleventy --serve",
|
||||
"watch:sass": "npm-run-all compile-sass minify-css -- --watch",
|
||||
"start": "npm-run-all compile-sass minify-css --parallel watch:*",
|
||||
"build": "npm run compile-sass && eleventy && npm run move-index && npm run minify-css",
|
||||
"build": "npm run compile-sass && eleventy && npm run move-index && npm run minify-css && node .compress-all.js",
|
||||
"move-index": "cpx dist/de/index.html dist/"
|
||||
},
|
||||
"author": "samuel-p",
|
||||
|
@ -23,7 +22,12 @@
|
|||
"devDependencies": {
|
||||
"@11ty/eleventy": "^1.0.0-canary.33",
|
||||
"@11ty/eleventy-navigation": "^0.2.0",
|
||||
"@node-minify/core": "^6.2.0",
|
||||
"@node-minify/crass": "^6.2.0",
|
||||
"@node-minify/html-minifier": "^6.2.0",
|
||||
"cpx": "^1.5.0",
|
||||
"glob": "^7.1.7",
|
||||
"minify": "^7.0.2",
|
||||
"node-sass": "^6.0.0",
|
||||
"node-sass-tilde-importer": "^1.0.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
|
|
Loading…
Reference in a new issue