Compiled scss to css file wont validate according to standard
When I compile from scss to css, the encoding of the css is "UTF-8 with BOM". This puts a special character at the beginning of the compiled css file before @charset "UTF-8"; The special characters makes the CSS to not validate in W3C CSS validator with the following validation error: The @charset rule may only occur at the start of the style sheet. Please check that there are no spaces before it. @charset "UTF-8";
Is there a config option that will give the encoding of the output as "UTF-8" instead of "UTF-8 BOM"?
I'll take a look; I have a new release ready, but was waiting on a possible pull request; if this is a straightforward fix, I'll try to squeeze it into the next release.
Hi again! Perfect. Do you have any estimate when a new release might come?
I did not have a chance to fix this issue yet; I'll try to look i to it today.
It looks like this should be a relatively easy fix, I'll add a bool outputUTF8Identifier option to the config, default to true if it's not present to maintain current behavior. I'll update the code over the weekend and test it at work over the next week to make sure no issues arise from the changes.
This should work for all types
{ "outputFile": "wwwroot/css/site.css", "inputFile": "Styles/site/scss/site.scss", "outputUTF8Identifier": false, "minify": { "enabled": false }, "options": { "sourceMap": true, "relativeUrls": false } }
// the back ticks are putting it in one line, sorry for the formatting
Is it possible to use the compilerconfig.json.defaults to configure outputUTF8Identifier so it always "false" instead of configure it for each entries?
I haven't tested it, but that should work
How should it be written in the defaults file? At the root level? I haven't seen any example to configure that kind of properties.
I've just tried to add it at the rook without success
{
"outputUTF8Identifier": false
"compilers": {
"less": {
"autoPrefix": "",
"cssComb": "none",
"ieCompat": true,
...
}
}
It should probably be in the SASS default options; I'll try to find time to test it, but I have a deadline for work at the moment, so it may be a bit.
I've just tested it in the SASS options and it doesn't work.
Would you mind opening a new issue for this as a feature request?
Here's the new issue to have the possibility to transform some WebCompiler specific properties as default value: #114