Bootstrap 4 SCSS compilation: Error: Invalid US-ASCII character “\xE2”

别等时光非礼了梦想. 提交于 2021-02-10 06:39:07

问题


Having issues compiling some bootstrap 4 modules (updating from beta3).

While the issue can be solved by setting @charset: 'UTF-8'; on _hover.scss mixin partial (which is noted as deprecated within the file), why would that be needed considering it should compile out of the box as previous beta versions.

Code in _hover.scss:

@mixin hover {
  &:hover { @content; }
}

@mixin hover-focus {
  &:hover,
  &:focus {
    @content;
  }
}

@mixin plain-hover-focus {
  &,
  &:hover,
  &:focus {
    @content;
  }
}

@mixin hover-focus-active {
  &:hover,
  &:focus,
  &:active {
    @content;
  }
}

After going through SCSS files can't figure exactly what's wrong, quotes seem ok.


回答1:


After going through it in detail seems to be the - character on top comments ("iOS-an issue..").

One can replace it for their own - character and should compile fine (or just add @charset: 'UTF-8'; at the top of the _hover.scss mixin file).

Issue report: https://github.com/twbs/bootstrap/issues/25391




回答2:


I ran into the same charset problem.

Especially on OSX there seams to be a problem with ruby Encoding Settings.

I fixed it creating a config.rb file in the main project directory to tell ruby explicitly which charset encoding it should use. Since sass and compass depend on ruby, chances good that this will fix your problems.

Encoding.default_external = 'utf-8'


来源:https://stackoverflow.com/questions/48371041/bootstrap-4-scss-compilation-error-invalid-us-ascii-character-xe2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!