Why Does SASS Prepend an Incorrect @Charset Rule

Why does Sass prepend an incorrect @charset rule?

Try adding @charset "UTF-8"; to your original SCSS file, SASS shouldn't override it/add its own then.

Why does Sass incorrectly convert css content?

Sass should be auto-detecting character encoding on your documents. If not for some reason, you can explicitly set it to UTF-8 using @charset "UTF-8";

From the SASS docs:

When running on Ruby 1.9 and later, Sass is aware of the character encoding of documents. Sass follows the CSS spec to determine the encoding of a stylesheet, and falls back to the Ruby string encoding. This means that it first checks the Unicode byte order mark, then the @charset declaration, then the Ruby string encoding. If none of these are set, it will assume the document is in UTF-8.

To explicitly specify the encoding of your stylesheet, use a @charset declaration just like in CSS. Add @charset "encoding-name"; at the beginning of the stylesheet (before any whitespace or comments) and Sass will interpret it as the given encoding. Note that whatever encoding you use, it must be convertible to Unicode.

Sass will always encode its output as UTF-8. It will include a @charset declaration if and only if the output file contains non-ASCII characters. In compressed mode, a UTF-8 byte order mark is used in place of a @charset declaration.

@charset "UTF-8";
.listing-price:before {
content: "♥";
}

Demo:

https://www.sassmeister.com/gist/6326e75075795d1c265d26467c06518c

Docs:

http://sass-lang.com/documentation/file.SASS_REFERENCE.html

How can I change charset in SASS (SCSS)

Try @charset "UTF-8"; on the beginning of file, before any spaces, comments.

error while compiling my sass code, how should i proceed from here on?

You need to check the encoding of your files. Check in the image you posted. The error message should explain what's going wrong. Looks like your file has been saved in a UTF-16 format. Make sure it's saved as a UTF-8 file and see what that does.

Take a look at https://stackoverflow.com/a/40365121/1248664 on changing your encoding in VS Code

PHPStorm .sass, .css and Deployment Settings Issue

1. You did the exclusions wrong: .sass will exclude just THAT file and not any other, e.g. abc.sass.

To exclude all .sass files you have to use *.sass (just as hint below that field says -- nothing more, nothing less).

2. No way (unfortunately) -- but sync will be working properly now (after you fix your #1).

Automatic upload should also do the job just fine (but you will have to tick Upload external changes option as well).



Related Topics



Leave a reply



Submit