Sass 相对路径

Sass 相对路径,sass,gulp,Sass,Gulp,sass给出了一条错误消息 Error: File to import not found or unreadable: helpers/mixins.scss Parent style sheet: .../temp/styles/all.scss on line 1 of temp/styles/all.scss >> @import 'helpers/mixins.scss'; ^ 在这一点上,代码看起来像 @import 'helpers/mixins.

sass给出了一条错误消息

Error: File to import not found or unreadable: helpers/mixins.scss
   Parent style sheet: .../temp/styles/all.scss
    on line 1 of temp/styles/all.scss
>> @import 'helpers/mixins.scss';
   ^
在这一点上,代码看起来像

@import 'helpers/mixins.scss';
@import 'helpers/variables.scss';
@import 'helpers/fonts.scss';
@import '../../node_modules/bootstrap/scss/bootstrap';
@import '../../node_modules/fotorama/fotorama.css';

.navbar {
  @extend navbar-light;
  @extend bg-faded;
}
吞咽任务看起来像这样

var blocks = 'app/blocks/**/*.scss';

gulp.task('styles', () => (
gulp.src(['app/styles/app.scss', blocks])
    .pipe(concat('all.scss'))
    .pipe(sass({
        errLogToConsole: true,
        indentedSyntax: false
    }))
    .pipe(gulp.dest('temp/styles'))
));
如何解决这个问题?
如何使galp正确理解方法?

在您的galp文件中,您可以声明sass路径,例如

var sassPaths = [
  'node_modules/bootstrap/scss',
  'node_modules/fotorama'
];
这些是相对于您的吞咽文件

然后在sass参数列表中设置include路径

.pipe(sass({
    errLogToConsole: true,
    indentedSyntax: false,
    includePaths: sassPaths
}))

然后在您的sass中,确保导入与父sass文件相关或与其中一个包含路径相关。

问题不在于导入路径,而在于编译器。sass编译器应该处理导入语句。使用针对VisualStudio的sass编译器从来没有遇到过任何问题,只是说这没有真正的问题,是吗?这是关于如何做和如何工作的文档:)