Skip to content

thelabnyc/esbuild-style-plugin

Repository files navigation

esbuild-style-plugin

Another esbuild plugin for your styling.

Install

npm i --save-dev @thelabnyc/esbuild-style-plugin

Usage

Look at the test files or here is a basic example.

import stylePlugin from "esbuild-style-plugin";

esbuild.build({
    plugins: [stylePlugin()],
});

Config

CSS Modules

Server-side Rendering

Set extract: false. This will cause ESBuild to not process CSS on server-side, but will keep the CSS class name mapping for CSS modules.

PostCSS

The plugin is using PostCSS to handle CSS module files. You can include any other plugins with the postcss option.

CSSNano

Do not use cssnano plugin. It won't work and if it did it minifies all files seperatly (slow not efficient). Instead, just let ESBuild minify do its job.

Preprocessor Import Types

Use typed-scss-modules.