feat: update postcss config
This commit is contained in:
parent
d83bc3d135
commit
598102a7ec
5 changed files with 57 additions and 57 deletions
|
@ -1,33 +0,0 @@
|
|||
// CSS and JavaScript as first-class citizens in Eleventy: https://pepelsbey.dev/articles/eleventy-css-js/
|
||||
|
||||
const postcss = require("postcss");
|
||||
const postcssImport = require("postcss-import");
|
||||
const postcssImportExtGlob = require("postcss-import-ext-glob");
|
||||
const autoprefixer = require("autoprefixer");
|
||||
const cssnano = require("cssnano");
|
||||
|
||||
module.exports = (eleventyConfig) => {
|
||||
eleventyConfig.addTemplateFormats("css");
|
||||
|
||||
eleventyConfig.addExtension("css", {
|
||||
outputFileExtension: "css",
|
||||
compile: async (content, path) => {
|
||||
if (path !== "./src/assets/css/global.css") {
|
||||
return;
|
||||
}
|
||||
|
||||
return async () => {
|
||||
let output = await postcss([
|
||||
postcssImportExtGlob,
|
||||
postcssImport,
|
||||
autoprefixer,
|
||||
cssnano,
|
||||
]).process(content, {
|
||||
from: path,
|
||||
});
|
||||
|
||||
return output.css;
|
||||
};
|
||||
},
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue