本文介绍了错误“无效的UTF-8”当用@import编译sass时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 项目
资产
脚本
我的项目包含以下结构样式
app.scss
bower_components
node_modules
公共
css
app.css
js
bower.json
gulpfile.js
package.json

我使用gulp-sass来编译app.scss到app.css,我想在app.scss中包含基础

  gulp.task('styles',function(){ 
return gulp.src(path.src.styles)
.pipe(sass({
includePaths:['./bower_components/foundation/scss']
}))
.pipe(concat('app.css'))
.pipe(gulp.dest(path.public.styles));
})



然后我在app.scss文件中输入:

  @import'foundation / _settings'; 
@import'foundation';

当我运行gulp时,我得到:

 错误:assets \styles\app.scss 
undefined:undefined无效的UTF-8

有什么不对?

解决方案

我认为您的UNIX不受支持你的文件夹路径?尝试删除它。



我通过删除文件夹名称中的字母ä删除了此错误。


There's my project with the folowing structire:

project
  assets
    scripts
    styles
      app.scss
  bower_components
  node_modules
  public
    css
      app.css
    js
  bower.json
  gulpfile.js
  package.json

I use gulp-sass to compile app.scss to app.css and i want to include foundation in app.scss

gulp.task('styles', function() {
    return gulp.src(path.src.styles)
    .pipe(sass({
        includePaths: ['./bower_components/foundation/scss']
    }))
    .pipe(concat('app.css'))
    .pipe(gulp.dest(path.public.styles));
})

Then I white in app.scss file:

@import 'foundation/_settings';
@import 'foundation';

And when i run gulp, I get:

Error: assets\styles\app.scss
  undefined:undefined  Invalid UTF-8

What's wrong?

解决方案

I think you have a UNIX unsupported letter in your folder path ? Try removing it.

I removed this error by removing the letter "ä" from the folder name.

这篇关于错误“无效的UTF-8”当用@import编译sass时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:24