Reputation: 1
I have a CSS Stylesheet which contains following code:
@charset "utf-8";
/* CSS Document */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video
{
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
}
I am facing these ERRORS
/* Minification failed. Returning unminified contents. (1189,1): run-time error CSS1019: Unexpected token, found '@charset' (1189,10): run-time error CSS1019: Unexpected token, found '"utf-8"' (1189,17): run-time error CSS1019: Unexpected token, found ';'
Upvotes: 0
Views: 3794
Reputation: 16017
I had the same error message, but in my case I was trying to load the CSS file with a <script>
tag. 🤦
Loading it with <link rel="stylesheet" href="foo.css">
worked as it should.
Upvotes: 3
Reputation: 2282
Only one @charset
may appear in a CSS and it must appear at the very start of the document. It must NOT be preceded by any characters, not even comments.
Most of the time, It's due to bundle CSS
along with another 'CSS' files.
My guess is that, you are using a bunch of css'es
in a single bundle and The topmost CSS in bundled files, Only can have @charset "utf-8"
.
Therefore you can set @charset "utf-8"
at the topmost CSS file in Bundle
statement (and make sure that you haven't use another @charset
declaration other than "utf-8"
if so, then you need to split bundled files into separate bundles, so that every @charset
accommodate at the top of it's bundle order).
NOTE: Since the HTTP header has a higher precedence than the in-document @charset
declaration, you may also want to omit @charset
statements and declare it in HTTP header.
Upvotes: 2