Plugin for esbuild to support postcss
npm install @deanc/esbuild-plugin-postcss(Huge thanks to https://github.com/koluch/esbuild-plugin-sass which this is based off)
!CI
Plugin for esbuild to support PostCSS
``bash`
npm i esbuild @deanc/esbuild-plugin-postcss`
or yarnbash`
yarn add esbuild @deanc/esbuild-plugin-postcss`
or pnpmbash`
pnpm add esbuild @deanc/esbuild-plugin-postcss
Create file src/test.css:
`css`
input[type="text"] {
border-radius: 1px;
}
Create file src/index.js:
`js`
import "./test.css";
Create file build.js:
`js
import esbuild from "esbuild";
import autoprefixer from "autoprefixer";
import postCssPlugin from "@deanc/esbuild-plugin-postcss";
esbuild
.build({
entryPoints: ["src/index.js"],
bundle: true,
outfile: "bundle.js",
plugins: [
postCssPlugin({
plugins: [autoprefixer()],
}),
],
})
.catch((e) => console.error(e.message));
`
Run:
`bash`
node build.js
File named bundle.css with appropriate postcss plugins applied.
- Node.js 22+
- This repo uses pnpm for CI. If you use pnpm locally, run pnpm import once to create pnpm-lock.yaml.
- The release workflow uses npm trusted publishing with provenance. Ensure trusted publishing is enabled for this package in npm before running the workflow.
- Release checklist:
1. Ensure CI is green on main.CHANGELOG.md
2. Verify has entries under [Unreleased]`.
3. Run the "Release package" workflow with the desired release type.