-
Notifications
You must be signed in to change notification settings - Fork 12k
@import statements are not moved to the top of the file anymore #9267
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
Can you provide the content of the css file described in the above repro steps? |
I cannot paste the whole file, as it is very large and not open source but I think the important point is that it starts like this: @import url('https://fonts.googleapis.com/css?family=Material+Icons');
html {
height: 100%
}
... |
In order to get my CI back working, I ran the
Concerning the css-bundling I did not find any changes in 1.6.5 and 1.6.6. I will pin to 1.6.2 until this is resolved. |
I can confirm that it also happens in 1.6.7 |
We'll definitely look into this. However, it's important to note that adding the fonts via absolute URL imports will have performance implications on the application. The browser will not be aware that it needs to fetch the assets until it parses the stylesheet. This can cause a delay of first render. Adding them to index.html allows the browser to become more quickly aware of the need to fetch and improve visual performance for the end user. As an example for
|
@clydin Thanks for the tip. @tommueller I noticed that the guide for Material fonts has changed from version 1.4.0 and onwards. Version 1.1.0 of the Angular Material wiki storie stated to add them in |
@clydin Thanks for the reply. I am aware that it is better to not use css imports. For now we use |
@clydin Any update on this? We use a bootstrap theme that has the font prebuilt into the css. Modifying the theme isn't really good practice. Would be nice if prod build could handle it even if there is performance hit. |
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version. If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. |
@alan-agius4 I'm having the same issue after update Angular CLI to 6.2.5 And seems that there are other guys that have the same issue. You can check it here: #10855 Have you in mind any kind of workaround for this? |
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
angular-cli.json
styles fieldObserved behavior
This is a regression bug. Building the project using cli version 1.5.0 pushes the
@import ...
statement of the imported css to the top of the generated*.bundle.css
-file. Doing the same with cli version 1.6.4 does not push the import up and hence the browsers don't import the css file.Desired behavior
Also version 1.6.4 should push the @import's to the top of the file, so that browsers import the dependencies.
The text was updated successfully, but these errors were encountered: