Skip to content

[Build Prod] transition shorthand unit lost when Angular-CLI 6.2.x #12408

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

Closed
hsuanxyz opened this issue Sep 30, 2018 · 7 comments · Fixed by #12565
Closed

[Build Prod] transition shorthand unit lost when Angular-CLI 6.2.x #12408

hsuanxyz opened this issue Sep 30, 2018 · 7 comments · Fixed by #12565

Comments

@hsuanxyz
Copy link
Contributor

hsuanxyz commented Sep 30, 2018

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

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

Versions

Angular CLI: 6.2.3
Node: 10.0.0
OS: darwin x64
Angular: 6.1.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.3
@angular-devkit/build-angular     0.8.3
@angular-devkit/build-optimizer   0.8.3
@angular-devkit/build-webpack     0.8.3
@angular-devkit/core              0.8.3
@angular-devkit/schematics        0.8.3
@angular/cli                      6.2.3
@ngtools/webpack                  6.2.3
@schematics/angular               0.8.3
@schematics/update                0.8.3
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.20.2

Repro steps

Repro: https://github.com/HsuanXyz/issues-ng-cli-6.2.x-clean-css-

/* input this */
.class {
  transition: opacity .3s linear, height 0s ease .3s;
}

/* ng build --prod */
.class{transition:opacity .3s linear,height .3s}

The log given by the failure

Desired functionality

/* input this */
.class {
  transition: opacity .3s linear, height 0s ease .3s;
}

/* ng build --prod */
.class{transition: opacity .3s linear, height 0s ease .3s}

Mention any other details that might be useful

NG-ZORRO PR: NG-ZORRO/ng-zorro-antd#2163

clean-css issues: clean-css/clean-css#1050

Reproduction: https://github.com/HsuanXyz/issues-ng-cli-6.2.x-clean-css-

@filipesilva
Copy link
Contributor

We can pin the cleancss version in #12441 for now, and wait for clean-css/clean-css#1050 to be fixed before updating.

@filipesilva
Copy link
Contributor

filipesilva commented Oct 3, 2018

I wasn't aware of it but clean-css is now looking for a new maintainer (clean-css/clean-css#1044) which usually means reduced support. We don't want to pin to an older version because that might resurface old bugs that have since been fixed.

Since you seem to have a workaround, already (not use the shorthand), we'll wait until this is fixed on clean-css. If it ends up not being fixed we might change to a different minifier within the CLI 7.x timeframe.

@mhartington
Copy link
Contributor

Just to add to this, clean-css is also causing some issues with Ionic's own styles in an Angular app.

screen shot 2018-09-20 at 1 19 16 pm

In this case, the dev builds without clean-css produces the css on the left. But when run through prod builds with optimizations enabled, the css selector for html end up getting merged together, breaking some platform specific styles we need.

Digging into the webpack plugin for clean-css, setting level to 0 prevents any of the styles from getting optimized, but still minifying the final output.

@alyssamichelle
Copy link

Heads up @hsuanxyz , you have a typo under Desired Functionality:
image
(Missing a t for the transition.)

@filipesilva filipesilva added the needs: discussion On the agenda for team meeting to determine next steps label Oct 5, 2018
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Oct 5, 2018

Pinning down clean-css to a previous version will reintroduce this issue #9902 (comment) which was fixed in 4.2.0

@clydin
Copy link
Member

clydin commented Oct 8, 2018

Please note also that you should be able to use special comments to make clean-css ignore a block of CSS:

/* clean-css ignore:start */
.class {
  transition: opacity .3s linear, height 0s ease .3s;
}
/* clean-css ignore:end */

hsuanxyz added a commit to hsuanxyz/angular-cli that referenced this issue Oct 12, 2018
hsuanxyz added a commit to hsuanxyz/angular-cli that referenced this issue Oct 12, 2018
@alan-agius4 alan-agius4 removed state: blocked needs: discussion On the agenda for team meeting to determine next steps labels Oct 15, 2018
alexeagle pushed a commit that referenced this issue Oct 18, 2018
alexeagle pushed a commit that referenced this issue Oct 18, 2018
@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 Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.