-
Notifications
You must be signed in to change notification settings - Fork 54
Prevent caching CSS when in development mode #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent caching CSS when in development mode #34
Conversation
Fixes issue #33
I think there should be change in writing logic, because now it is appending to css file. So it should do something like this. if |
And there is another thing to solve, we have to send all css contents to writeCss function because now it accepts only current transpiled css file and not all the previous css files. |
I am testing with single CSS file and combined CSS is always being overwritten. Ah that's because of https://github.com/michalkvasnicak/babel-plugin-css-modules-transform/blob/master/src/utils/extractCssFile.js#L33 |
It is overwriting file if there is only 1 css file otherwise it is appending and this causes tests to fail. |
I see, you're right. Let me see what I can do about it. |
If I run I skip initial build because there is no way to know when It's possible to run babel without |
I think that we could solve regeneration of whole combined css file. We could always rewrite whole combined css file but I am not sure what impact it'll have on performance of plugin. Maybe we can do checks in cache not only by filename but hash of contents for example? Then we'll know if we need to overwrite the whole combined css file or just keep it as is because contents haven't changed. |
So in non |
Another option would be to always append in Performance wise this would be much faster then looping through all styles and generating combined CSS. This should also address my case with I mean all of it is not ideal right? |
Yeah but you'll end up with rewriting file anyway because if the string you want to strip is in the middle of the combined CSS file you don't have a way to strip it. So maybe something like, if the file is new append otherwise strip and rewrite. And we could keep the generated CSS in memory too. |
Closing, you can try |
Fixes issue #33