Skip to content

feat: implement full CSS pipeline as Rolldown plugin#787

Merged
sxzz merged 7 commits intomainfrom
sxzz/css-support
Mar 3, 2026
Merged

feat: implement full CSS pipeline as Rolldown plugin#787
sxzz merged 7 commits intomainfrom
sxzz/css-support

Conversation

@sxzz
Copy link
Member

@sxzz sxzz commented Mar 3, 2026

Summary

Rolldown has completely removed native CSS support. This implements the full CSS pipeline as a Rolldown plugin, following Vite's cssPlugin pattern.

  • CssPlugin: Single plugin replacing both LightningCSSPlugin and CssCodeSplitPlugin — handles CSS loading, preprocessing, collection per chunk, and asset emission
  • Preprocessor support: Sass/Less/Stylus compilation with URL rebasing for imported files from different directories
  • Direct Lightning CSS: Replace unplugin-lightningcss with direct lightningcss.transform() API for CSS syntax lowering
  • CSS code splitting: Per-chunk CSS assets (splitting mode) or merged single CSS file (non-splitting mode)
  • Expanded CssOptions: Added preprocessorOptions (scss/sass/less/styl/stylus) and lightningcss configuration

Architecture

JS imports ./style.css or ./style.scss
  → load hook: read file, compile preprocessor, Lightning CSS lowering,
    store in styles map, return { code: '', moduleSideEffects: 'no-treeshake' }
  → renderChunk: collect CSS per chunk, emit .css assets or accumulate
  → generateBundle: merge all CSS into single file (non-splitting mode)

Related Issues

Rolldown has completely removed native CSS support. This implements
the full CSS pipeline (load → preprocess → store → collect → emit)
as a Rolldown plugin, following Vite's cssPlugin pattern.

- Add CssPlugin that handles CSS loading, preprocessing, and emission
- Support Sass/Less/Stylus preprocessors with URL rebasing
- Replace unplugin-lightningcss with direct lightningcss.transform() API
- Support CSS code splitting (per-chunk) and merging (single file)
- Expand CssOptions with preprocessorOptions and lightningcss config
- Un-skip CSS and target CSS tests
@netlify
Copy link

netlify bot commented Mar 3, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 5355353
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69a70b432c3eb00008769bbd
😎 Deploy Preview https://deploy-preview-787--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 3, 2026

Open in StackBlitz

tsdown

pnpm add https://pkg.pr.new/tsdown@787 -D
npm i https://pkg.pr.new/tsdown@787 -D
yarn add https://pkg.pr.new/tsdown@787.tgz -D

create-tsdown

pnpm add https://pkg.pr.new/create-tsdown@787 -D
npm i https://pkg.pr.new/create-tsdown@787 -D
yarn add https://pkg.pr.new/create-tsdown@787.tgz -D

@tsdown/exe

pnpm add https://pkg.pr.new/@tsdown/exe@787 -D
npm i https://pkg.pr.new/@tsdown/exe@787 -D
yarn add https://pkg.pr.new/@tsdown/exe@787.tgz -D

tsdown-migrate

pnpm add https://pkg.pr.new/tsdown-migrate@787 -D
npm i https://pkg.pr.new/tsdown-migrate@787 -D
yarn add https://pkg.pr.new/tsdown-migrate@787.tgz -D

commit: 8dc3f10

sxzz and others added 6 commits March 3, 2026 21:48
- Expand CSS docs with preprocessors, Lightning CSS, and code splitting
- Update target docs to reference lightningcss instead of unplugin-lightningcss
- Update skills reference with full CSS options and examples
- Add Chinese translations for all CSS documentation
Library builds typically want a single merged CSS file. Change the
default from true to false so all CSS is merged into style.css by
default. Users can opt into per-chunk splitting with splitting: true.
@sxzz sxzz merged commit dbe3cc9 into main Mar 3, 2026
15 of 16 checks passed
@sxzz sxzz deleted the sxzz/css-support branch March 3, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant