LoginSignup
3
3

More than 5 years have passed since last update.

WindowsでGrunt-Sassコンパイル時にcharacter "\xE6"が出た時の対処法

Posted at

Windows環境下でgrunt-contrib-sassでコンパイル時に以下のエラーが表示された時の対処法

Running "sass:dist" (sass) task
Error: Invalid Windows-31J character "\xE6"
        on line 5 of xxx/xxx/yyy.scss
  Use --trace for backtrace.
Warning: Exited with error code 65 Use --force to continue.

原因

コンパイル対象のSCSSに日本語(漢字)が含まれていることでエラーが発生しています

例えば以下のようにfont-familyに日本語を含む場合

yyy.scss
body {
    font-family: Verdana, "游ゴシック", YuGothic, "メイリオ", Meiryo, "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "MS Pゴシック", sans-serif;
}

対策方法

scssファイルの先頭行に@charset "utf-8";を追加してあげればOK

yyy.scss
@charset "utf-8";
body {
    font-family: Verdana, "游ゴシック", YuGothic, "メイリオ", Meiryo, "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "MS Pゴシック", sans-serif;
}

以上

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3