question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unmatched selector: %

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: @angular-devkit/build-angular: 12.2.10

Issue first appears with @angular-devkit/build-angular 12.2.11

Description

With 12.2.10 a production build there are no warnings. With 12.2.11 I am getting the following output (in fact my first build actually had over 200 such errors!). There is no easy way to track down the source CSS rule from the error message.

β ‹ Generating index html...2 rules skipped due to selector errors:
  0% -> Unmatched selector: %
  0% -> Unmatched selector: %
βœ” Index html generation complete.

πŸ”¬ Minimal Reproduction

Add the following CSS to any application:

.demo {
  background: red;
}
@keyframes demo {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(359deg);
  }
}

πŸ”₯ Exception or Error


β ‹ Generating index html...2 rules skipped due to selector errors:
  0% -> Unmatched selector: %
  0% -> Unmatched selector: %
βœ” Index html generation complete.

🌍 Your Environment


Angular CLI: 12.2.10
Node: 14.17.2
Package Manager: npm 6.14.13
OS: win32 x64

Angular: 12.2.10
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1202.10
@angular-devkit/build-angular      12.2.11
@angular-devkit/core               12.2.10
@angular-devkit/schematics         12.2.10
@angular/cdk                       12.2.9
@angular/material                  12.2.9
@angular/material-moment-adapter   12.2.9
@schematics/angular                12.2.10
rxjs                               6.6.7
typescript                         4.3.5

Anything else relevant?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
NealGoochcommented, Oct 26, 2021

Alan,

Many many thanks for the very quick response - changing browserlist to your suggestion does indeed fix this issue.

(Aside: I’ve picked up support for this app and it hadn’t occurred to me review the browserlist !!! I’m down to a handful of users stuck on IE11 so would have probably reviewed it once I had them shifted to a newer browser)

Thanks again, Neal.

1reaction
alan-agius4commented, Oct 26, 2021

The above browserslist configuration is rather permissive and a number of the resulting browsers are not supported which would also result in extra css prefixes and therefore increase in bundle size.

Can you try the below?

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
IE 11
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular build - Unmatched selector: % - Stack Overflow
When I run npm run build which executes ng build -c production build will be completed as expected. But command prompt will be...
Read more >
Unexpected Warning: rules skipped due to selector errors ...
In my styles.scss I have the following import as the first line: @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;Β ...
Read more >
Selectors Explained
Selectors Explained. Translate CSS selectors into plain English. Selector Explain ✨. Unmatched selector: \. © Made with by Kitty Giraudel · GitHub.
Read more >
Angular 12 production build warning (MDB4 12)
Generating index html...8 rules skipped due to selector errors: .custom-file-input:lang(en)~.custom-file-label -> unmatched pseudo-class :langΒ ...
Read more >
Detect Unmatched CSS Selectors with Helium
A great tool called Helium is available to help developers detect selectors in their stylesheets that are unmatched or malformed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found