Registry / devops / rollup-plugin-css-asset

rollup-plugin-css-asset

JSON →
library1.0.2jsnpmunverified

A Rollup plugin that bundles imported CSS files into a separate CSS asset file, respecting Rollup's asset handling and sourcemap options. Version 1.0.2 is the current stable release; the plugin is in maintenance mode with no recent updates. It differentiates from other CSS plugins by focusing on simplicity: no post-processing, no JS injection, just emitting CSS as a Rollup asset with hashing and path customization. Requires Rollup >=1.19.0.

npm install rollup-plugin-css-asset
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-CSS-
R
rollup-plugin-css-asset
devopsjavascriptv1.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (css)
import css from 'rollup-plugin-css-asset'
const css = require('rollup-plugin-css-asset')
Plugin is ESM-only; CommonJS require will fail.
css (named import)
import { css } from 'rollup-plugin-css-asset'
import { default as css } from 'rollup-plugin-css-asset'
Package exports both default and named 'css', but default is preferred for clarity.
TypeScript types
import css from 'rollup-plugin-css-asset'
Package includes TypeScript types; no separate type import needed.

Basic Rollup configuration using rollup-plugin-css-asset to bundle CSS into a separate asset file with hashing and sourcemaps.

// rollup.config.js import css from 'rollup-plugin-css-asset'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'es', sourcemap: true, assetFileNames: 'assets/[name]-[hash][extname]', }, plugins: [ css({ name: 'bundle', }), ], };
Debug
Known issues
gotchaPlugin does not process CSS (no autoprefixer, minification, etc.); it emits CSS as-is.
fix
Combine with postcss plugin (e.g., rollup-plugin-postcss) if CSS processing is needed.
affects: >=1.0.0
gotchaCSS files must be imported in JavaScript to be bundled; standalone CSS references are ignored.
fix
Ensure all CSS files are imported in your entry points or dependencies.
affects: >=1.0.0
gotchaThe plugin only emits a single CSS asset per build; multiple inputs produce one CSS file.
fix
Use code splitting or multiple plugin instances if separate CSS outputs are required.
affects: >=1.0.0
breakingVersion 1.0.0 dropped support for Rollup <1.19.0.
fix
Upgrade Rollup to >=1.19.0.
affects: >=1.0.0 <2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-css-asset'
Package not installed or not in devDependencies.
fix
Run: npm install --save-dev rollup-plugin-css-asset
TypeError: css is not a function
Using CommonJS require() instead of ESM import.
fix
Change to: import css from 'rollup-plugin-css-asset'
The emitted file 'assets/bundle-xxxxx.css' does not contain any CSS content.
No CSS files imported in the JavaScript bundle.
fix
Add import './styles.css' in your entry file.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-css-asset — npm install rollup-plugin-css-asset · libregistry