Another esbuild plugin for your styling.
- Supports Sass as a preprocessor
- Handles CSS modules automatically with PostCSS
- You can include PostCSS plugins (autoprefixer, preset-env)
- Support PostCSS/TailwindCSS dependencies for watching files - https://github.com/postcss/postcss/blob/main/docs/guidelines/plugin.md#3-dependencies
- Supported server-side rendering.
- Includes d.ts files in dist
- Support esbuild watch
- Written in Typescript with maintainable code
npm i --save-dev @thelabnyc/esbuild-style-plugin
Look at the test files or here is a basic example.
import stylePlugin from "esbuild-style-plugin";
esbuild.build({
plugins: [stylePlugin()],
});extractdefault to truecssModulesMatchmatch.module.by defaultcssModulesOptionshttps://github.com/madyankin/postcss-modules#usagerenderOptionspostcsspluginsarray of postcss accepted pluginsparser|syntaxparse source css - use with postcss-scss
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.
The plugin is using PostCSS to handle CSS module files. You can include any other plugins with the postcss option.
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.
Use typed-scss-modules.