Compare commits
No commits in common. "d7ce139ab78c75ca5ebe15b3c5f2aa55d6f3c679" and "04a26a22894d25be81e832663bdf3fe32fcdc138" have entirely different histories.
d7ce139ab7
...
04a26a2289
8 changed files with 5 additions and 51 deletions
27
.eleventy.js
27
.eleventy.js
|
|
@ -1,33 +1,6 @@
|
||||||
const CleanCSS = require("clean-css");
|
|
||||||
// const is_production = typeof process.env.NODE_ENV === "string" && process.env.NODE_ENV === "production";
|
|
||||||
const is_production = true;
|
|
||||||
|
|
||||||
function do_minifycss(source, output_path) {
|
|
||||||
if(!output_path.endsWith(".css") || !is_production) return source;
|
|
||||||
|
|
||||||
const result = new CleanCSS({
|
|
||||||
level: 2
|
|
||||||
}).minify(source).styles.trim();
|
|
||||||
console.log(`MINIFY ${output_path}`, source.length, `→`, result.length, `(${((1 - (result.length / source.length)) * 100).toFixed(2)}% reduction)`);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function (eleventyConfig) {
|
||||||
// eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
// eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
||||||
|
|
||||||
eleventyConfig.addFilter("cssmin", function (code) {
|
|
||||||
return new CleanCSS({}).minify(code).styles;
|
|
||||||
});
|
|
||||||
|
|
||||||
eleventyConfig.addTransform("cssmin", do_minifycss);
|
|
||||||
|
|
||||||
eleventyConfig.addTransform("log", async function (content) {
|
|
||||||
console.log(this.page.inputPath);
|
|
||||||
console.log(this.page.outputPath);
|
|
||||||
|
|
||||||
return content; // no changes made.
|
|
||||||
});
|
|
||||||
|
|
||||||
eleventyConfig.setNunjucksEnvironmentOptions({
|
eleventyConfig.setNunjucksEnvironmentOptions({
|
||||||
// throwOnUndefined: true,
|
// throwOnUndefined: true,
|
||||||
trimBlocks: true
|
trimBlocks: true
|
||||||
|
|
|
||||||
19
package-lock.json
generated
19
package-lock.json
generated
|
|
@ -10,7 +10,6 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^2.0.1",
|
"@11ty/eleventy": "^2.0.1",
|
||||||
"clean-css": "^5.3.3",
|
|
||||||
"sass": "^1.69.4"
|
"sass": "^1.69.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -540,18 +539,6 @@
|
||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/clean-css": {
|
|
||||||
"version": "5.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz",
|
|
||||||
"integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"source-map": "~0.6.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/color-convert": {
|
"node_modules/color-convert": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
|
@ -596,9 +583,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.6",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"path-key": "^3.1.0",
|
"path-key": "^3.1.0",
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^2.0.1",
|
"@11ty/eleventy": "^2.0.1",
|
||||||
"clean-css": "^5.3.3",
|
|
||||||
"sass": "^1.69.4"
|
"sass": "^1.69.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ tags:
|
||||||
{% set bodyClass = "body_portal" %}
|
{% set bodyClass = "body_portal" %}
|
||||||
|
|
||||||
{% extends "demo/_default.njk" %}
|
{% extends "demo/_default.njk" %}
|
||||||
{% import "hippie/macros/_gate.njk" as gate %}
|
{% import "demo/macros/_gates.njk" as gate %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ tags:
|
||||||
{% set bodyClass = "body_new" %}
|
{% set bodyClass = "body_new" %}
|
||||||
|
|
||||||
{% extends "demo/_app.njk" %}
|
{% extends "demo/_app.njk" %}
|
||||||
{% import "hippie/macros/_state.njk" as state %}
|
{% import "demo/macros/_states.njk" as state %}
|
||||||
|
|
||||||
{% block title %}{{ title }}
|
{% block title %}{{ title }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
eleventyComputed: {
|
|
||||||
path: demoMode ? "/" : "/demo/"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue