Setup css minification
MODIFY
website/.eleventy.js
website/.eleventy.js
+const CleanCSS = require("clean-css");
+
module.exports = function(eleventyConfig) {
+ eleventyConfig.addFilter("cssmin", function(code) {
+ return new CleanCSS({}).minify(code).styles;
+ });
+
return {
dir: {
input: "src",

MODIFY
website/package.json
website/package.json
"dev": "yarn eleventy --serve"
},
"dependencies": {
- "@11ty/eleventy": "^0.11.0"
+ "@11ty/eleventy": "^0.11.0",
+ "clean-css": "^4.2.3"
}
}

MODIFY
website/src/includes/layout.njk
website/src/includes/layout.njk
@@ -10,7 +10,7 @@ title: A JavaScript toolchain | Rome
{% set css %}{% include 'styles.css' %}{% endset %}
- <style>{{ css | safe }}</style>
+ <style>{{ css | cssmin | safe }}</style>
<body>

MODIFY
website/yarn.lock
website/yarn.lock
@@ -599,7 +599,7 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"
-clean-css@^4.1.11:
+clean-css@^4.1.11, clean-css@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78"
integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==

Setup css minification