
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@baurine/esbuild-plugin-postcss3
Advanced tools
This plugin is forked from esbuild-plugin-postcss2.
It fix some bugs of upstream likes can't compile with bluma-css, fluent-ui.
It also support cache, it can reduce the incremental rebuild time in dev mode from several seconds to less than one second.
It supports module replacement as well.
yarn add -D @baurine/esbuild-plugin-postcss3
or
npm i -D @baurine/esbuild-plugin-postcss3
Add the plugin to your esbuild plugins:
const esbuild = require("esbuild");
const postCssPlugin = require("@baurine/esbuild-plugin-postcss3");
esbuild.build({
...
plugins: [
postCssPlugin.default()
]
...
});
Add your desired PostCSS plugin to the plugins array:
const autoprefixer = require("autoprefixer");
esbuild.build({
...
plugins: [
postCssPlugin.default({
plugins: [autoprefixer]
})
]
...
});
PostCSS modules are enabled by default. You can pass in a config or disable it with the modules field:
postCssPlugin.default({
// pass in `postcss-modules` custom options
// set to false to disable
modules: {
getJSON(cssFileName, json, outputFileName) {
const path = require("path");
const cssName = path.basename(cssFileName, ".css");
const jsonFileName = path.resolve("./build/" + cssName + ".json");
fs.writeFileSync(jsonFileName, JSON.stringify(json));
}
}
});
To use preprocessors (sass, scss, stylus, less), just add the desired preprocessor as a devDependency:
yarn add -D sass
To reduce the rebuild time in dev mode, you can try to cache the CSS compilation result.
Note: currently it only supports
.css/.less/.scss, doesn't support.stylyet.
const esbuild = require("esbuild");
const postCssPlugin = require("@baurine/esbuild-plugin-postcss3");
esbuild.build({
...
plugins: [
postCssPlugin.default({
enableCache: true
})
]
...
});
Support to replace a css file by another when building, works same as the webpack NormalModuleReplacementPlugin.
Usage:
esbuild.build({
...
plugins: [
postCssPlugin.default({
moduleReplacements: {
[path.resolve(__dirname, 'node_modules/antd/es/style/index.less')]:
path.resolve(__dirname, 'src/my_antd.less'),
},
}),
],
...
});
FAQs
Use postcss with esbuild
The npm package @baurine/esbuild-plugin-postcss3 receives a total of 36 weekly downloads. As such, @baurine/esbuild-plugin-postcss3 popularity was classified as not popular.
We found that @baurine/esbuild-plugin-postcss3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.