A lightweight esbuild plugin that bundles and inlines CSS into JavaScript files during the build process. Currently at version 0.0.1, this plugin provides a simple integration for developers who want to avoid separate CSS files by embedding styles directly into their JS bundles. It supports CommonJS and is intended for esbuild-based projects. Unlike more comprehensive solutions like esbuild-style-plugin, it focuses solely on CSS inlining without additional features like minification or CSS modules. The release cadence is unclear given the early version.
npm install esbuild-plugin-inline-cssVerified import paths — ran on the pinned version, not inferred.
Shows how to bundle and inline CSS into a single JS output using esbuild and the plugin.
Use plain CSS imports without query parameters.
Use InlineCSSPlugin() instead of new InlineCSSPlugin()
Ensure this plugin is placed after any resolve-altering plugins.
Run npm install -D esbuild-plugin-inline-css
Use InlineCSSPlugin() (no new).
Ensure the CSS file exists and the import path is correct.