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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opacity Converted to 1% #20126

Closed
2 tasks done
mousedownmike opened this issue Feb 23, 2021 · 3 comments
Closed
2 tasks done

Opacity Converted to 1% #20126

mousedownmike opened this issue Feb 23, 2021 · 3 comments

Comments

@mousedownmike
Copy link

馃悶 Bug report

Command (mark with an x)

  • build
  • serve

Is this a regression?

I have gone back to 10.1.3 and the problem exists there.

Description

A clear and concise description of the problem...

When SCSS opacity values are provided as percentages they are always converted to 1% when run the cli runs with --prod.

馃敩 Minimal Reproduction

  1. ng new opacity-bug --style scss
  2. Replace the app.component.html and app.component.scss values with the example below.
  3. Run ng serve --prod

app.component.html

<div class="toolbar"></div>

app.component.scss

.toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: #1976d2;
  opacity: 80%;
}

馃敟 Exception or Error

Inspect the .toolbar style in the browser and observe:

.toolbar[_ngcontent-sja-c0] {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #1976d2;
    opacity: 1%;
}

This issue does not appear when running in development mode (e.g. ng serve)

馃實 Your Environment


Angular CLI: 11.2.1
Node: 12.20.2
OS: linux x64

Angular: 11.2.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.1
@angular-devkit/build-angular   0.1102.1
@angular-devkit/core            11.2.1
@angular-devkit/schematics      11.2.1
@angular/cli                    11.2.1
@schematics/angular             11.2.1
@schematics/update              0.1102.1
rxjs                            6.6.3

Anything else relevant?

Using opacity: .8 fixes the problem

@mousedownmike
Copy link
Author

This appears to be a cssnano problem:
cssnano/cssnano#957

@alan-agius4
Copy link
Collaborator

Indeed this is a CSSNano problem which is not actionable by the Angular CLI.

Duplicate of #17516

@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 Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants