I'm working on a Svelte app and using this plugin with rollup. I had the following setup:
...,
css({ output: "bundle.css" }),
which does create bundle.css, but unfortunately the output changes on every run. Here I diff the output between two runs, after having inserted newlines between the CSS blocks:
Now I'm working around the issue by sorting first:
css({ output: (styles, stylesNodes) => {
// stylesNodes is a map from filename (e.g.
// 'src/lib/components/ui/FiltersCard.css') to css content (e.g.
// '.filter.svelte-1f2mdt{display:flex;justify-content:space-between;...').
if(!fs.existsSync("public/build")) {
fs.mkdirSync("public/build");
}
fs.writeFileSync("public/build/bundle.css", Object.values(stylesNodes).sort().join(''));
}}),
(somewhat related: is there a way I could simply return a string here? then I wouldn't need to re-add public/build which is the directory I specify with output.file = "public/build/bundle.js")
Hi,
I'm working on a Svelte app and using this plugin with
rollup
. I had the following setup:which does create
bundle.css
, but unfortunately the output changes on every run. Here I diff the output between two runs, after having inserted newlines between the CSS blocks:Now I'm working around the issue by sorting first:
(somewhat related: is there a way I could simply return a string here? then I wouldn't need to re-add
public/build
which is the directory I specify withoutput.file = "public/build/bundle.js"
)Thanks!