Skip to content

Commit

Permalink
Add CSS nesting in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansimorph committed Jun 1, 2024
1 parent e2319c6 commit 25123e4
Show file tree
Hide file tree
Showing 4 changed files with 1,344 additions and 208 deletions.
8 changes: 6 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const eleventyVue = require("@11ty/eleventy-plugin-vue");
const svgContents = require("eleventy-plugin-svg-contents");
const imageShortcode = require("./src/utils/image.js");
const htmlnano = require("htmlnano");

module.exports = function (config) {
config.addPlugin(eleventyVue, {
Expand All @@ -9,7 +10,6 @@ module.exports = function (config) {
postcssPlugins: [
require("postcss-import"),
require("postcss-mixins"),
require("postcss-nested"),
require("postcss-custom-units"),
require("postcss-round-float"),
],
Expand All @@ -19,7 +19,11 @@ module.exports = function (config) {

config.addPlugin(svgContents);

config.addTransform("htmlmin", require("./src/utils/htmlmin.js"));
config.addTransform("htmlnano", async (content, outputPath) => {
if (!outputPath.endsWith("html")) return content;

return await htmlnano.process(content).html;
});

config.addPassthroughCopy({ "./src/assets/": "/" });

Expand Down
Loading

0 comments on commit 25123e4

Please sign in to comment.