-
Notifications
You must be signed in to change notification settings - Fork 12k
Prod build re-orders and alters scss styles #10579
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
Comments
Yes I'm having this issue also with my scss files... I have a mixin for animation that will get altered and produce incorrect css.
For localhost it comes out just fine:
When I use the prod flag though..
I've noticed though that it doesn't appear this way when I disable AoT (since it's on by default with
Anyone know what version this started happening in the CLI? Might downgrade until this issue is resolved. It's too frightening to have this possibility happen to any of my mixins. Also may be related, but as I compile I'm also receiving this warning in the console:
|
Ok so I got around this by just downgrading to Angular CLI version 1.6.0 on both npm global and on the local project. For Global:
For Project:
It might yell at you though for not having @angular-devkit/core when you do ng build. For me I just installed it as a dev-dependency and I was able to create my dist build. If it yells at you like in this related post here
|
Any news on this fix? Hoping to move to Angular 6 soon. |
Still having this issue on 6.1.1 EDIT: same symptoms, ng serve runs fine, ng serve --prod --aot does not respect css rule precedence. |
Is there any fix available related to this issue? Can't get my css to work with ng build --prod --aot |
Still having this issue on 6.1.4 |
This is expected since during production builds by default CSS gets minified to generate the smallest possible bundle and options get combined together using If you have some code which is not side effect free you need to disable the optimisations for that piece of code using See https://github.com/jakubpawlowicz/clean-css#whats-new-in-version-42 |
Closing as per comment above. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Repro steps
ng new test-proj-name --minimal true --style scss
Paste following into styles.scss
ng build -ec
View the following css output in dist/styles.bundle.css:
ng build -prod
View the following css output in dist/styles.GUID.bundle.css:
Observed behavior
The border-width, border-style, and border-color have been combined into the single border shorthand property and moved to the end of the th selector when using the -prod flag. This negates the fact that border-left, border-right, and border-top properties were all set to 0 in the original scss to override the border. It is now these settings that are being overwritten.
Desired behavior
The order of the output css should not be altered from its original order in the scss. Everything would be fine in this specific use case if the border property had been added at the beginning of the selector, but I haven't thought of other potential flaws here.
The text was updated successfully, but these errors were encountered: