Extract CSS separately for every file of the array of rollup entry points
See original GitHub issueExtracting CSS into a single file breaks treeshaking. I only want to ship critical styles. So as rollup turns every entry point to separate output chunks it would be great if there were a possibility to have the same for CSS instead of just generating one file which contains all the styles.
// config
rollupConfig = {
input: ['./src/components/Button/index.js', './src/components/Input/index.js'],
output: [
{
dir: lib,
format: 'cjs',
sourcemap: true,
exports: 'named'
},
],
plugins: [
postcss({
modules: true,
extract: true,
sourceMap: true,
minimize: true
})
]
}
// result
.
└───components
│ └─── Input
│ │ index.js
│ └─── Button
│ │ index.js
└───folder2
│ index.js
│ chunk.js
│ styles.css
//expected result
.
└───components
│ └─── Input
│ │ index.js
│ │ styles.css
│ └─── Button
│ │ index.js
│ │ styles.css
└───folder2
│ index.js
│ chunk.js
│ styles.css
Issue Analytics
- State:
- Created 4 years ago
- Reactions:92
- Comments:14
Top Results From Across the Web
Bundle Stylesheets and Add LiveReload With Rollup
Learn how to use the JavaScript bundler Rollup to process stylesheets using PostCSS and rebuild & reload files when changes are made in...
Read more >Extract CSS separately for every file of the array of rollup entry points
Extracting CSS into a single file breaks treeshaking. I only want to ship critical styles. So as rollup turns every entry point to...
Read more >rollup.js
You can export an array from your config file to build bundles from several unrelated inputs at once, even in watch mode. To...
Read more >Create separate CSS files in postcss & rollup - Stack Overflow
js", }, plugins: [ resolve({ browser: true, }), postcss({ plugins: [postcssImport(), postcssNested(), autoprefixer()], extract: true, sourceMap: ...
Read more >The Ultimate Guide to Getting Started with the Rollup.js ...
The tool compiles all your JavaScript source files into a single ... easy to get started but you'll discover plugins for HTML, CSS,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s a use case:
You have a large react-rollup component library that is consumed by a
create-react-app
application. They only need one component, and also need to run postcss on that component’s css to ensure it’s properly scoped. The component library already ships each component as a separate entry point, but can’t get the per-component css extracted, and are unable to support postcss in the consuming application.has any progress for this feature ?