节点sass不导入
我正在用nodejs,electron和node-sass构build一个sass编译器。
将有一个configuration文件,将描述许多项目的一些“sass编译器”,用户将有能力通过GUI来激活和停用它们。
我用“电子”来pipe理界面,并使用电子“ipcmain”来按需启动编译器。
为了初始化编译器,我生成了一个包含整个编译器的subprocess。
编译完成以下代码:
var result = this.sass.renderSync({ file: 'C:\\Users\\George\\Desktop\\css_compiler_tests\\test3\\scss\\style.scss', outFile: 'C:\\Users\\George\\Desktop\\css_compiler_tests\\test3\\css\\style.css', includePaths:[ 'C:\\Users\\George\\Desktop\\css_compiler_tests\\test3\\scss\\', 'C:\\Users\\George\\Desktop\\css_compiler_tests\\test3\\scss\\foundation\\components\\' ] });
我使用绝对path执行编译,但文件是相对path。
我运行我的程序/ gui,并激活编译器,我有一个CSS文件。
问题是一些import缺less。
我的根文件夹位于'C:\ Users \ George \ Desktop \ css_compiler_tests \ test3 \'。
我尝试编译导入'scss_inculded-files.scss'的'scss \ style.scss'。
文件'scss_inculded-files'导入'scss \ foundation.scss',它导入'scss \ foundation \ components'格式。
这里是一个例子:
/*scss\style.scss*/ @import "included-files"; /*scss\_inculded-files.scss*/ @import "includes/fonts", "includes/custom-colors", "includes/foundation-custom-settings", "foundation/settings", "foundation"; /*scss\foundation.scss*/ @import "foundation/components/grid", "foundation/components/accordion";
最后两次导入的内容丢失。
最后,我尝试从命令行并得到了同样的错误:
D:\mytests\nodejs\nodeSass> node_modules/.bin/node-sass C:\Users\George\Desktop\css_compiler_tests\test3\scss\style.scss -o C:\Users\George\Desktop\css_compiler_tests\test3\scss\ --include-path C:\Users\George\Desktop\css_compiler_tests\test3\scss\
有没有一种方法来包括那些丢失的文件?
先谢谢你。
编辑1经过一些实验后,我发现Mixins是问题所在。
假设我有这样一个Mixin:
@mixin headline($size, $color: $base-color) { color: $color; font-size: $size; }
如果我这样称呼它,它是完美编译的:
h1 { @include headline($color: blue, $size: 12px); }
如果我不叫它不编译。
我正在使用基金会Zurb框架,我相信汽车包括mixin。