@deanc/esbuild-plugin-postcss

1.0.2 • Public • Published

(Huge thanks to https://github.com/koluch/esbuild-plugin-sass which this is based off)

esbuild-plugin-postcss

Node.js CI

Plugin for esbuild to support PostCSS

Install

npm i esbuild @deanc/esbuild-plugin-postcss

or yarn

yarn add esbuild @deanc/esbuild-plugin-postcss

Usage example

Create file src/test.css:

input[type="text"] {
  border-radius: 1px;
}

Create file src/index.js:

import "./test.css";

Create file build.js:

const esbuild = require("esbuild");
const autoprefixer = require("autoprefixer");
const postCssPlugin = require("@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:

node build.js

File named bundle.css with appropriate postcss plugins applied.

Readme

Keywords

Package Sidebar

Install

npm i @deanc/esbuild-plugin-postcss

Weekly Downloads

2,230

Version

1.0.2

License

ISC

Unpacked Size

6.41 kB

Total Files

11

Last publish

Collaborators

  • deanc