question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to disable @charset include

See original GitHub issue

Is there a way to disable the auto-adding of the @charset? It can’t be present in AMP CSS - we currently use sass to compile our amp css.

We also concatenate on the server (in some rare circumstances) and if the files generated each have a charset, the resulting concatenation has several charsets inside.

I am currently using gulp-sass which wraps node-sass which uses LibSass. Is there anyway we can expose an option to disable the charset?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
nex3commented, May 18, 2017

Is there a way to disable the auto-adding of the @charset?

There is not, other than manually trimming it yourself after the fact.

It can’t be present in AMP CSS - we currently use sass to compile our amp css.

We target the official CSS spec when we generate. If a downstream tool doesn’t correctly handle valid CSS, that’s an issue for that tool.

We also concatenate on the server (in some rare circumstances) and if the files generated each have a charset, the resulting concatenation has several charsets inside.

In this case, the concatenation script falls under the definition of a “downstream tool”. In order to correctly concatenate CSS, you must be resilient to the existence of @charset declarations.

Is it true it will only add it when it finds non-ascii characters? Or does it just add it regardless?

It’s only added when non-ASCII characters exist.

0reactions
lkraavcommented, Dec 16, 2022

https://sass-lang.com/documentation/cli/dart-sass#no-charset seems to say there’s a --no-charset option available.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove charset=utf-8 in a Content-Type header ...
Manually setting a header value via HttpHeaders , passed to return ResponseEntity . Each time the resulting header is as follows: Content-Type: ...
Read more >
HttpClient: How to Remove Charset From Content-Type Header
Solution is simple - we can create StringContent with whatever encoding and then set charset to empty string.
Read more >
HttpClient: How to remove charset from ... - Gunnar Peipman
This removes charset definiton from request content type header. My code started work after this change.
Read more >
How to remove "charset=UTF-8" from Content-Type - MSDN
You have a couple of options: 1. If Apache prefer a different charset, you could change it by setting the RequestEncoding on your...
Read more >
Completely disable all support for a certain CHAR SET in ...
Sessions can negotiate its own character set ( SET names ). That was a problem because, at least for some time, the PHP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found