Eleventy plugin for PostCSS
npm install eleventy-plugin-postcssnode@^18.0.0@11ty/eleventy@^3.0.0.css, .postcss, .pcss.postcss.config.js file. (more info)npm install --save-dev eleventy-plugin-postcss.eleventy.js:js
// Import (ES6 modules)
import PostCSSPlugin from "eleventy-plugin-postcss";export default function (eleventyConfig) {
// Enable the plugin in you project
eleventyConfig.addPlugin(PostCSSPlugin);
}
`
OR
`js
// CommonJS
const PostCSSPlugin = require("eleventy-plugin-postcss");module.exports = (eleventyConfig) => {
// Enable the plugin in you project
eleventyConfig.addPlugin(PostCSSPlugin);
}
`Configure PostCSS
Create a postcss.config.js config file for additional configuration. (more info). Example:
`js
import mixins from "postcss-mixins";
import nested from "postcss-nested";
import preset from "postcss-preset-env";/* @type {import('postcss-load-config').Config} /
const config = {
plugins: [
mixins(),
nested(),
preset({ stage: "0" })
]
}
export default config;
`Configuration
To load and resolve the configuration file the plugin uses postcss-load-config` module. Check out the project readme for the complete list of supported config file formats.