Replies: 1 comment 4 replies
-
@drwpow This would be a great addition to the rollup plugin. I've tried in the past to get rollup to bundle all generated CSS into a single file but never managed to get it to work. A PR with the feature would be much appreciated. I will mention though that CSS ordering definitely matters in some cases. For example, if you want to include a CSS reset, typically this would be need to be right at the top of your stylesheet. Additionally, Ideally styles would be ordered in the stylesheet in the order that rollup traverses the in. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hello! Experimenting with Vanilla Extract building a UI library, and I’m using the Rollup plugin. The generated output leaves the following JS in the output:
This works when running it back through a bundler in an app, but when shipping a library to npm, this becomes a footgun because it requires re-bundling JS which could break the app (not to mention it’s annoying to deal with in tests).
I’d love to add an
extract
option to the Rollup plugin:output: { dir: "dist", }, plugins: [ vanillaExtractPlugin({ + extract: "styles.css", // outputs to dist/styles.css }), ],
That then doesn’t leave any CSS imports in the JS, just bundles them together into a CSS file as-named.
Advantages
Details
extract
Alternatives
I’d also be interested in adding it to the Vite plugin, too, just for parity.
Beta Was this translation helpful? Give feedback.
All reactions