Closed jkphl closed 7 years ago
I see that this has been merged. My setup is a little different, as I'm using Webpack's posscss-loader
instead of Gulp. With this setup having multiple entry points trying to write to the same critical css file still overrides each time, persisting only the last write. Any way around this?
At the moment, when run through Gulp with multiple streams the
critical.css
gets overwritten for each single input file, effectively resulting in a CSS containing only the critical rules for the last processed input file. Adding the"a"
flag to thefs.writeFile()
call appends to thecritical.css
instead of overwriting it repeatedly.I'm sorry for not adding a proper test. I don't know the libs you're using for testing and I'm also not sure how easy it is to simulate the multiple-files-in-a-row situation without Gulp. Possibly it would be better to delete / overwrite the
critical.css
for the first input file and append to it for all the following ones. No idea of how to achieve this though ... As I need a quick fix I'm fine with cleaning up the remainders myself before each run.