Closed jonathanrevell closed 8 years ago
Thanks for posting this PR!
I believe the new work in the master branch should address this, but let me know if I've missed anything.
It looks like your changes address all the problems we were experiencing! Thanks for fixing this.
In our project using JSPM, we import sub-modules which in turn import CSS. With the way plugin-css was operating before, it would run into race conditions as cleanCSS wrote out to the file, and then css-builder would often stomp on those changes as well. Additionally, any nested @imports would be lost entirely. To fix this, I modified the css-builder to capture asynchronous CSS loads and use appendFileSync instead of writeFileSync, to avoid overwrites. Finally, I changed the final write to the file (which, due to async, may not truly always be the final one) to only add the sourceMap designation and not re-append/rewrite the same CSS that cleanCSS has already written out itself.