This plugin for postcss built with intention to create fast, high-performance, reliable and tested solution to ESBuild with postcss and post-css modules
npm i esbuild-postcss-plugin
Add plugin to ESBuild build config
const postCSSPlugin = require("esbuild-postcss-plugin");
plugins: [postCSSPlugin()];
A regular expression to filter source files processed by plugin
Default: /\.css$/
postCSSPlugin({ filter: /\.css$/ });
Cache gives more speed on rebuild. Unfortunately, in cases when postcss transform result depends on other files, cache will cause incorrect behavior. For example, tailwindcss scans template files to build final CSS, and changes in templates require CSS cache invalidation.
Default: false
postCSSPlugin({ disableCache: true });
A regular expression to filter source files processed with postcss-modules
Default: /\.module.css$/
postCSSPlugin({ modulesFilter: /\.module.css$/ })
See postcss-modules package options: https://github.com/madyankin/postcss-modules
Warning! Loader
, resolve
and root
options will be ignored.
Default: empty
postCSSPlugin({
modulesFilter: /\.css$/,
modulesOptions: {
globalModulePaths: [/index.css$/],
}
})
List of AcceptedPlugin for postcss.
Default: []
postCSSPlugin({
plugins: [require("autoprefixer")]
})