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.

rgba converted to hex notation when compiling library with ng-packagr - breaks IE11

See original GitHub issue

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Yes, this problem was not present in earlier versions of the compiler and/or ng-packagr. I migrated from Angular 8.2.14 and ng-packagr 5.7.1 to Angular 12.2.11 and ng-packagr 12.2.4. The regression is in one of the intermediate version.

Description

When using rgba in CSS (color, background-color or similar), the library compilation do transform the rgba encoding to HEX, for instance color: #ffffffbf. This seems related to #21652 , which was present in early 12.2.X versions. My main project had a similar issue with version 12.2.0, which was solved by upgrading to 12.2.9 (which is the current version of my main project). The library compilation however seems to still have the problem with 12.2.11 Angular version.

🔬 Minimal Reproduction

It’s difficult to provide a minimal reproduction due to the dependency between the several projects involved (main Angular application and ng-packagr library). My current setup :

  • first npm workspace contains two projects in angular.json file : The library itself ("projectType": "library") and a demo application to start and debug locally the library ("projectType": "application"). When starting the demo application through ng serve library-project-demo --configuration es5, the rgba CSS directives are NOT transformed into HEX and therefore are working properly.
  • second npm workspace contains the main application. It does import the library from our nexus npm internal repository by referencing it in package.json. When starting the main application through ng serve --configuration es5, the rgba CSS directives which are inside our main application code are NOT transformed into HEX and are working, but the ones that comes from the library ARE transformed into HEX and therefore broken on IE11.

It seems the commits used to fix #21652 are working for the compilation of a main application, but are somehow not fixing the libraries compilation.

🔥 Exception or Error

No error nor exception. HEX rgba CSS directives are ignored by Internet Explorer 11.

🌍 Your Environment


@angular-devkit/architect       0.1202.11
@angular-devkit/build-angular   12.2.11
@angular-devkit/core            12.2.11
@angular-devkit/schematics      12.2.11
@schematics/angular             12.2.11
ng-packagr                      12.2.4
rxjs                            6.5.3
typescript                      4.3.5

Anything else relevant?

Specific to Internet Explorer.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Wisdomb33rcommented, Oct 26, 2021

@alan-agius4 That’s it ! My library project had no .browserslist file. I verified in our GIT and it never had one. Maybe the Angular 8 CLI wasn’t generating one when I started the project. According to my documentation I used :

ng new internal-libs --create-application=false
ng g library plate-lib
ng g application plate-demo

And the CLI migration to 9, 10, 11 and 12 did not add it either. After adding it manually everything works fine. Thanks a lot for suggesting the browserslist file and for the (incredibly) fast fix yesterday.

0reactions
angular-automatic-lock-bot[bot]commented, Nov 26, 2021

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rgba converted to hex notation in Component Styles - breaks ...
No Description When running "ng build", Angular v12 converts rgba to hex notation for component style (css / less / sass) This causes...
Read more >
Color: rgba() workaround for Internet Explorer? - Stack Overflow
Just enter the proper (hex notation) color and prioritize it using important will work. I hope this helps some other webdesigners as well!...
Read more >
@angular-devkit/build-ng-packagr | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
ng-packagr: Versions - Openbase
Compilation of libraries using VIew Engine is no longer supported. ... Bug Fixes. RGBA converted to hex notation in component styles breaks IE11...
Read more >
https://raw.githubusercontent.com/angular/angular-...
@angular-devkit/build-angular - TypeScript versions older than 4.8.2 are no longer ... fix | RGBA converted to hex notation in component styles breaks IE11...
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