bootstarted / css-split-webpack-plugin

Split your CSS for stupid browsers using webpack and postcss.
78 stars 22 forks source link

4095 rules or selectors? #26

Open mygaochunming opened 6 years ago

mygaochunming commented 6 years ago

@izaakschroeder thanks for your work. But IE's limit is not 4095 selectors? An article about IE limits

Though it says 4095 rules in the article, but I have see some comments in the article said the limit maybe 4095 selectors, and I have test it myself. I think 4095 selectors maybe right.

izaakschroeder commented 6 years ago

Hey @mygaochunming 😄 Is this a bug you're raising here or just a question? From my understanding you're right the limit is 4095 selectors. You can see here in the discussion: https://stackoverflow.com/questions/9906794/internet-explorers-css-rules-limits. You're free to test for yourself of course.

mygaochunming commented 6 years ago

@izaakschroeder Thanks. I have seen this in the readme

size: default: 4000 The maximum number of CSS rules allowed in a single file. To make things work with IE this value should be somewhere around 4000.

The size is related to CSS rules.

I don't known which size should I set when I use the plugin, because if I set to 4000 (rules), the count of the selectors maybe break the limit.

Now I used 3500 rules size in my project, I hope it will not break the limit. But if I can set the size to 4095 selectors, I can have a good sleep every day, do not need to worry about it will break the limit in my project.

This is not a bug, maybe a new feature.

izaakschroeder commented 6 years ago

I guess I should adjust the README.md file. The code actually does use selector count and not rule count. You can see here: https://github.com/metalabdesign/css-split-webpack-plugin/blob/master/src/chunk.js#L10 😄

mygaochunming commented 6 years ago

@izaakschroeder Thanks.

Before going to sleep, I have another question:

defer: default: 'false'. You can pass true here to cause this plugin to split the CSS on the emit phase. Sometimes this is needed if you have other plugins that operate on the CSS also in the emit phase. Unfortunately by doing this you potentially lose chunk linking and source maps. Use only when necessary.

Assume there is a plugin B which operate on the css in the emit phase.

If B change the count of the selectors or other limit options, it maybe break the limit.

But if B do not change any of the limit options, then it does not matter.

Am I right?

Though set defer to true, the plugins executed asynchronously, it also can't ensure this plugin executed after the other plugins.

Am I right?