You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extracted and inlined styles produce different source order #108
Converting a project from webpack I discovered that my css-classes were applied in a different order than previously when using rollup-plugin-postcss. I think the issue boils down to the module resolution working in a breadth-first order when it should really be depth-first. I've thrown together a simple test case which illustrates the issue here: https://github.com/dnjstrom/extract-css-source-order.
The files will be transformed and extracted breadth-first (row-by-row):
A.js -> B.js -> A.scss -> B.scss
meaning A's classes will be defined above B's in the extracted file. This results in B's styles overriding A's instead of the other way around, if they're applied to the same element (a situation which is very common with React components).
The expected behavior is to do depth-first (column-by-column):
A.js -> B.js -> B.scss -> A.scss
Here A's styles override B's, as they are supposed to, and this is also what happens when the styles are inlined.
Conclusions
The extract feature of rollup-plugin-postcss is unlikely to work whenever you have an overlap of styles, which is likely a lot of projects.
Activity
dnjstrom commentedon Jun 1, 2018
Probably related: #96
Ensure order is the same
Ensure order is the same
Ensure order is the same