-
Notifications
You must be signed in to change notification settings - Fork 115
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
Add failing test for same file contents #68
Conversation
PTAL I manage to come up with a fix. The crux here is files containing any import rules should not be skipped. |
From what I understand you are getting some files that looks the same with import(s) + rules but imports refer to different files ? |
Yep, exactly. |
Also I now think skipping files silently might not be a good idea. It can cause some rule failed to be overridden. For example @import "foo/red.css";
@import "reset.css";
@import "bar/red.css"; and both body {
background: url(red.png);
} reset.css body {
background: none;
} If I think skipping files based on absolute url is good enough. |
Good point. Any objection @magsout ? |
Well, just realize skipping files based on absolutely url is wrong too: @import "foo/red.css";
@import "reset.css";
@import "foo/red.css"; I think for css, no files should be skipped. |
I understand that the test on the hash can introduce a bug on your example. Even though I do not consider it as a real bug. But I try to understand the relevance of your example. It's not really logical to do that, if I may? Or at compile we can specifie that the file is skipped because the same content as such a file. |
@magsout, you can not expect users to be always logical and not make mistakes like this. I think we should leave the job of removing unnecessary rules to a css compressor. |
I agree that @hgl example doesn't really make sense in practise. @hgl the idea was (for example) to avoid having normalize.css several times if some modules use it. And importing normalize (still for the example) can override previously defined values... So in both cases, so "bugs" are possible... |
LGTM 👍 |
@MoOx what we are currently discussing is if files with the same contents (but contain no imports) should be skipped. But this PR is to not skipping files containing imports (the previous implementation seems to also do that, but with a plain I hope this PR is still good for merging. |
Yeap. |
Add failing test for same file contents
I still think skipping files with same content is a bad idea. I will open a new issue with a more practical example. |
#67 ? |
Yep, I will add to that issue. writing it. |
I can confirm that the file is not imported.