Skip to content

Conversation

@romainmenke
Copy link
Collaborator

@romainmenke romainmenke commented Jul 20, 2023

resolves : #462

It is untrue that browsers only use the last import.
They use all of them.

Up until now however this wasn't observable.

With the introduction of @layer CSS now has something that is registered when first encountered and can not be overwritten later, making the real behavior clear.

When skipDuplicates: false is set postcss-import will produce CSS that is equivalent to browser behavior.

This change adds handling of cyclical imports in the same way as browsers resolve these cycles. This removes any differences between bundled or unbundled CSS as affected by import order.


See WebKit implementation : https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/StyleRuleImport.cpp#L123-L131

@romainmenke romainmenke changed the title check cycles check import cycles Jul 20, 2023
@romainmenke romainmenke marked this pull request as draft July 20, 2023 18:11
@romainmenke romainmenke force-pushed the check-cycles--empathetic-numbat-90ac1e6ee1 branch from 76ebef6 to c5a8870 Compare July 20, 2023 21:24
@romainmenke romainmenke marked this pull request as ready for review July 20, 2023 21:57
@romainmenke romainmenke requested a review from RyanZim July 20, 2023 21:57
Copy link
Collaborator

@RyanZim RyanZim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry so slow in reviewing here; looks good.

@RyanZim RyanZim merged commit f99379c into master Sep 30, 2023
@RyanZim RyanZim deleted the check-cycles--empathetic-numbat-90ac1e6ee1 branch September 30, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate imports are resolved in the wrong order

3 participants