-
Notifications
You must be signed in to change notification settings - Fork 12k
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 Problem on --prod build #8577
Comments
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please? You can read here why this is needed. A good way to make a minimal repro is to create a new app via |
Hi @filipesilva @clydin Thank you for your reply and for the efforts that you're doing for the community. I fixed the problem with a workround and i will explain you how : I have a component that encapsulates a component (a progress bar) from a third party library (ngx-bootstrap)
In the css part of my gaming component i override the native css of the progress bar to turn it pink :
In this configuration my After searching on the web i came out with a workaround :
So It turn out that when i changed the I still believe that it's an agular cli prod build bug because i have to have the same behavior on the simple serve and the serve with prod turned on. I'm trying hard to isolate the code and to setup an easy reproduction app for you guys. Thx. |
Yes it might be a problem in our CSS pipeline. It might also be related to AOT. Can you see if it happens with |
Hi @filipesilva
PS : I tested all the above commands also with the angular-cli So just to conclude :
Hope this helps. |
Hi! I had the same issue with my angular-cli/material2 application. In my angular @component's i was using Maybe that helps!? |
I'm having trouble replicating this. I tried with both CLI 1.5.4 & 1.6.0-rc.0 and added |
Same problem here :-/ |
It seems that the -prod parameter chooses the wrong order for the styles in .angular-cli.json. Example:
In non -prod mode, the syles.scss overwrites the bootstrap.css (correct). In the -prod mode, just the other way around (wrong). |
Seems to be fixed in latest beta release. |
I have this issue since 1.6.4. Reverting to 1.6.3 works. |
Can you solve the problem by updating to 1.7.0-beta.1? |
@Deccoy yes, this issue is not present with 1.7.0-beta.1 (but I have others :) |
I have the same issue with CSS ordering in production bundle. |
I manually move all the styles from the angular-cli styles array into style.scss with imports in the correct order and It worked |
Yes as a workaround but it should be fixed nonetheless |
Same issue here when I build with a production target
The issue is fixed with : |
I think @Deccoy is right. Just checked the generated styles file. |
I too had the same issue, and using |
Same issue with 1.7. Open Source = Spend more time tracking down other peoples errors... Quality control where? |
Same issue with Angular 5 & Angular CLI 1.7.3 |
This is still and issue in Angular 5 & Angular CLI 1.7.3 |
Just encountered this. Bump, fix please. |
Not directly related but in case someone lands here and has a similar issue: I also had an issue where CSS was wrong when compiled with AOT and CLI > 1.6.3 TL:DR |
@lafama |
Not sure if it's the same issue, but in case this helps someone... I noticed broken/missing CSS when I added I guess the AOT compiler just throws out the CSS immediately after whatever it deems "invalid" which is confusing because it results in different (broken) CSS to the dev build, and without any errors, and the warning messages are not very helpful troubleshooting. |
I think this the same issue as #9475 Try using bootstrap in scss and 2 custom css file. Check the final output of the primary color in development mode (ng serve) You will see that the output is not the same. ------------------------------------------ ng --version ----------------- Package Version@angular-devkit/architect 0.7.5 |
Seems that the workaround at this point is to include all your global styles in src/styles.scss rather than builder options in angular.json. |
Why is the issue closed? The bug still persists in Angular 7, like seriously, it's about time to address it. |
There is a similar problem to reproduce. NG-ZORRO/ng-zorro-antd/issues/2980 |
I have created a reproduction for this issue. Here is the github repo. To see it working without the prod flag: Also here is a screen capture showing the correct behavior on the left and the incorrect behavior on the right. |
@alan-agius4 can this be reopened since we have a way to demonstrate the issue that can hopefully provide a path forward? |
fixed this on angular 7, found one css file on the project : app.component.css, once renamed to app.component.scss the build is ok. |
@jadhemar-MD I don't believe that to be the case for my reproduction above. If you send a PR that fixes the issue I'll humbly admit I'm wrong and buy you a beer. 😄 |
hi @adamduren, would be hard to send a PR for this :), what can i say is that we got the white page trouble because angular tried to load the old removed css (type MIME error in console). In our case the issue come from a forgotten css file in a component, once we moved this one from css to scss, i can confirm that fix the trouble. Thanks to @Deccoy 's post who show me the way #8577 (comment) |
@jadhemar-MD I don't think this applies in my case. Thanks for tips though! |
I did some work to remove Ionic to rule that out as a factor and the issue without Ionic still occurs. |
Here are the results of my testing. I tried multiple variations of options by modifying So in my case it seems that AOT is the issue. Base Options:
|
Ok, I've figured it out at least for my case. See this commit. In my more complex example I had a base styles object that was being spread into various Essentially AOT breaks the animation because it doesn't spread the base styles into object passed to the style function. I was able to determine this by looking at the AOT output. If you checkout that repo and switch between the last two commits with a prod build you will see the bug in action. Essentially it should switch between a red and blue square and never be green. If it's green then you know the styles for the animation states are not being applied. I now know a workaround although it's less than ideal. |
Considering creating a separate issue since after testing it's possible these two are unrelated. |
@adamduren Can you tell us about the workaround? I still have the problem with
|
does anyone got solution for this problem with angulat cli 7.3.9 version In my case, i created custom element (microapp) using angular elements, and inside base application i declared css variables, inside microapp i used them, basic motive is to pass styles from base app to micro app using css variables. It is working fine on my local. does anyone has any idea about same. |
any updates on this? |
It turned out to be an interesting case. |
I used angular CLI, default configuration of Tsconfig doesnt have preserveWhitespaces in it. If i add this field into tsconfig, still it is not working |
Had the same issue with |
Still have this issue in angular:
Is possible that this can interfere? ->
|
As above said, I fixed it by edit package.json.
|
Having the same with |
The bug still persists in Angular v8.2.5 (@angular/cli: 8.3.4) |
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
I have also a masonry layout that is good.
My Masonry layout is also broken (hard to demonstrate sorry!) but i think all is related !
Observed behavior
Desired behavior
Mention any other details that might be useful (optional)
The text was updated successfully, but these errors were encountered: