I am working on angular app and while run the app it's not showing any errors but I'm getting this kind of warning's in many css files.
Module Warning (from ./node_modules/postcss-loader/src/index.js):
Warning
(114:1) @import must precede all other statements (besides @charset)
What I have imported on 114 line is this.
@import url(http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);
Where ever I have imported like this in all that css showing this kind of warnings.
Is there any solution for this?
If the import conditions do not match, the rules in the imported stylesheet do not apply. Is the name of a cascade layer into which the contents of the linked resource are imported. Imported rules must come before all other types of rules, except @charset rules. The @import rule is not a nested statement.
The @import rule is not a nested statement. Therefore, it cannot be used inside conditional group at-rules. So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent import conditions. These conditional imports specify comma-separated media queries after the URL.
This plugin attempts to follow the CSS @import spec; @import statements must precede all other statements (besides @charset ). Since your imports are not at the top, you're going to get an error.
Rules can also be imported into an existing cascade layer. The layer keyword or the layer () function is used with @import for this purpose. Declarations in style rules from imported stylesheets interact with the cascade as if they were written literally into the stylesheet at the point of the import.
I want to explain it through two screenshots that why it is giving warning. Because you are not using @import ....line at first line. See this screenshot it is giving warning.
see below screenshot this is the solution:
Warning has gone because I have used @import ... line at first line in styles.css file.
Your css loader plugin attempts to follow the @import
where its not at the top of (first lines of) the css file. @import
statements must precede all other statements (besides @charset
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With