vanilla-extract icon indicating copy to clipboard operation
vanilla-extract copied to clipboard

rollup can't extra css file

Open zerofront opened this issue 3 years ago • 3 comments

Describe the bug

I'm creating a ui group library using vanilla-extract、react、rollup。

how can I separate the css file and not import it in the js code?

image

Can all styles be packaged into one css file ?

Reproduction

https://github.com/graup/vanilla-extract-rollup-example/tree/main/packages/ui

System Info

rollup

Used Package Manager

yarn

Logs

No response

Validations

zerofront avatar Nov 16 '22 08:11 zerofront

Hi, the purpose of the rollup plugin is to specifically NOT bundle all CSS into one file to enable tree-shaking and consumers only needing to include the CSS for components they actually use. If you want all styles bundled, I recommend using a different bundler (like Vite).

However, we can discuss making this configurable in the rollup plugin.

graup avatar Dec 07 '22 05:12 graup

I think it's a good idea, especially if it doesn't require a major lift or refactor. One could write a roll up or babel plugin to subsequently remove it, but it would be easier if this plugin had an option to not include it altogether.

roginfarrer avatar Jan 16 '23 17:01 roginfarrer

Hi, the purpose of the rollup plugin is to specifically NOT bundle all CSS into one file to enable tree-shaking and consumers only needing to include the CSS for components they actually use. If you want all styles bundled, I recommend using a different bundler (like Vite).

However, we can discuss making this configurable in the rollup plugin.

Is there any configuration available for this? If the component library wishes to provide an umd package, it also needs to provide a bundle of all CSS @graup

zerofront avatar Feb 15 '23 07:02 zerofront