使用WebStorm中的Ruby SCSS转换器解决资产位置问题

我有这个SCSS结构:

app styles.scss bower_components _colors.scss _fonts.scss sass index.scss 

styles.scss:

 @import "sass/index"; 

index.scss:

 @import "bower_components/_colors"; @import "bower_components/_fonts"; 

app文件夹在File Watcher设置中设置为工作目录,在WebStorm中标记为“Resource Root”。 但是,转换失败并出现错误: error sass/index.scss (Line 3: File to import not found or unreadable: bower_components/_colors.)

我读过@import在SCSS中的评估

  1. 相对于当前文件位置
  2. 相对于根位置

但就我而言,很明显Ruby转换器不会尝试查找相对于根位置的文件。 这是一个错误吗? 或者我做错了什么?

我通过Ruby安装了SCSS并根据https://www.jetbrains.com/help/webstorm/2016.1/transpiling-sass-less-and-scss-to-css.html设置了文件监视器

这是我的文件监视器设置:

在此处输入图像描述

在命令行中运行scss.bat时,您将得到完全相同的问题:

 C:\Projects\prj>cd app C:\Projects\prj\app>C:/Ruby193/bin/scss.bat --no-cache --update sass/index.scss error sass/index.scss (Line 1: File to import not found or unreadable: bower_components/_colors.) 

请参阅https://github.com/sass/sass/issues/652 :自动放置在Sass加载路径上的当前工作目录在3.3中已弃用。 您需要使用-I选项显式传递加载路径,以使用相对于工作目录的文件夹。 喜欢:

在此处输入图像描述