Skip to content
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

css being reordered in devkit 0.1102.11, causing styles to not work correctly #20693

Closed
1 of 15 tasks
liamdebeasi opened this issue May 4, 2021 · 2 comments · Fixed by #20695
Closed
1 of 15 tasks

css being reordered in devkit 0.1102.11, causing styles to not work correctly #20693

liamdebeasi opened this issue May 4, 2021 · 2 comments · Fixed by #20695

Comments

@liamdebeasi
Copy link

🐞 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, this previously worked in @angular-devkit/build-angular@0.1102.10.

Possibly related to 8abb3e4

Description

When running a production build of an Angular app, imported stylesheets have their properties reordered, leading to styles being incorrectly applied when running the app in a browser.

🔬 Minimal Reproduction

Code Reproduction: https://github.com/liamdebeasi/ng-css-issue

  1. Run npm install in the 11.2.10 directory. This will install Angular 11.2.10 and its dependencies.
  2. From that directory, run ng build --prod.
  3. Open the styles file that has been generated inside of the www directory. The following CSS should be in that file:
.ion-padding-start{padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}
  1. Run npm install in the 11.2.11 directory. This will install Angular 11.2.11 and its dependencies.
  2. From that directory, run ng build --prod.
  3. Open the styles file that has been generated inside of the www directory. The following CSS should be in that file:
.ion-padding-start{-webkit-padding-start:16px;padding-inline-start:16px;padding-left:unset}

Expected Behavior

In Angular 11.2.11, I would expect that the ordering of my CSS is preserved as in Angular 11.2.10 and earlier.

Actual Behavior

In Angular 11.2.11, my CSS is reordered when the app is compiled.

Other Info

Because of this reordering the "ion-padding-start" class no longer adds padding on the starting side of an element as expected. This is because padding-left is being modified after padding-start in Angular 11.2.11 even though the source CSS has padding-left being modified before padding-start.

This is impacting Ionic Framework applications (ionic-team/ionic-framework#23266)

🌍 Your Environment


Angular CLI: 11.2.11
Node: 15.9.0
OS: darwin x64

Angular: 11.2.11
... cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.11
@angular-devkit/build-angular   0.1102.11
@angular-devkit/core            11.2.11
@angular-devkit/schematics      11.2.11
@schematics/angular             11.2.11
@schematics/update              0.1102.11
rxjs                            6.5.5
typescript                      4.0.7
@alan-agius4
Copy link
Collaborator

Possibly related to cssnano/cssnano#1054

@ngbot ngbot bot added this to the Backlog milestone May 4, 2021
clydin pushed a commit that referenced this issue May 5, 2021
…ptimizations

CSS declaration orders matters in some cases. This optimization is currently causing broken CSS output.

Closes #20693
clydin pushed a commit that referenced this issue May 5, 2021
…ptimizations

CSS declaration orders matters in some cases. This optimization is currently causing broken CSS output.

Closes #20693
clydin pushed a commit that referenced this issue May 5, 2021
…ptimizations

CSS declaration orders matters in some cases. This optimization is currently causing broken CSS output.

Closes #20693

(cherry picked from commit 678773f)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.