-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Invalid selector rules being skipped in production mode #25725
Comments
Hey @alan-agius4, thanks for getting this moved to the most appropriate place! My apologies for not realizing all issues weren't opened against the main Angular repo. I'm happy to do some more digging into this and try to at least do some triage, but could you possibly point me in the right direction to get started? I just recently started using Angular for a new job and am not extremely familiar with it's internals yet. |
This is caused by Critters. |
I was told this is a duplicate: #27067 But my selector is not an "Invalid selector rule", it's a valid rule just not recognized. It continues to happen still. What can be done about it? |
@waterplea My fix since originally opening this issue has been to disable inlining of critical CSS. I did not observe any negative detriment to web vitals or perceived page performance in doing this, but everyone's mileage could vary. |
This is not actionable from our end, please file an issue with https://github.com/danielroe/beasties |
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Unknown
Description
When importing Bootstrap while using the default SCSS setup, critical CSS inlining fails and outputs errors to the console about the rules being skipped (full error text below).
This appears to be an issue with SCSS parsing in the default Angular setup because the errors referenced below have invalid selectors in them citing
.form-floating > ~ label
. This is an invalid selector, but having checked the compiled Bootstrap directly, there is no reference to this class. The base style is simply.form-floating > label
while there are a number of styles in the format of.form-floating > [another selector] ~ label
.Based on the double space after the
>
selector, it seems one of those intermediary selectors is being removed during CSS processing.The minimal reproduction is based off of a fresh
ng new
project where SCSS is deleted, Bootstrap is loaded in via NPM and imported inglobal.css
. No other configuration has changed or third-party code introduced.Please provide a link to a minimal reproduction of the bug
https://github.com/jodylecompte/reproduction-ng-critical-css-bootstrap
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
Suspicion of this being related to critical CSS inlining is based off of the errors disappearing if
inlineCriticalCss
is disabled in the ngExpressEngine configuration.The text was updated successfully, but these errors were encountered: