egoist / rollup-plugin-postcss

Seamless integration between Rollup and PostCSS.
MIT License
675 stars 215 forks source link

Bundle webcomponent.js with webcomponent.css #450

Open frankred opened 1 year ago

frankred commented 1 year ago

I have a pure vanilla webcomponent, lets call it "Spinner.js" and a "Spinner.css". Can I bundle this to just one JS-File including the CSS file?.

Currently my rollup configuration looks like this, but CSS ins not bundle inside *.JS File

const bundle = await rollup({
        input: `${webcomponent.pathToWebcomponent}`,
        plugins: [nodeResolve(), commonjs(),postcss({
            extract: false,
            minimize: true,
            inject: {
                insertAt: 'top',
            },
        }), terser()],
    })