编译SCSS时出现假阳性“未定义变量”错误使用红宝石编译我的SCSS时得到错误消息。run: /var/lib/gems/1.8/gems/compass-0.12.2/bin/compass compile
out: unchanged sass/partial/grid.scss
out: error sass/partial/catalog.scss (Line 5: Undefined variable: "$paragraphFont".)
out: create css/generated/partial/catalog.css
out: create css/generated/partial/base.css
out: overwrite css/generated/screen.css我的screen.scss导入这样的部分:@import "partial/base";
@import "partial/catalog";在我的base部分我有$paragraphFont定义。$paragraphFont: 'Lucida Sans', arial;
$regularFontSize: 14px;和在catalog.scss我用它:.product-view #price-block {
p {
font-weight: normal;
font-family: $paragraphFont;
....
}
}奇怪的是,CSS编译得很好,而$paragraphFont正确填充。所以我不知道为什么编译器会抱怨我出错了。
3 回答
RISEBY
TA贡献1856条经验 获得超5个赞
当您只需要编译顶级文件时,您正在编译所有的Sass
toplevel.scss include child1.scss include child2.scss (that also uses variables from child1.sass but does not import child1.scss) include child3.scss (that also uses variables from child1.sass but does not import child1.sass)
gulp.task('sass', function () { gulp .src('./static/scss/toplevel.scss') // NOT *.scss .pipe(sass()) // Rest is just decoration .pipe(prefixer('last 2 versions', 'ie 9')) .pipe(gulp.dest('./static/css/dist')) .pipe(livereload(livereloadServer)); });
万千封印
TA贡献1891条经验 获得超3个赞
屏幕.scss->屏幕.css base.scss->base.css 目录.scss->Directory.css
屏幕.scss->屏幕.css _base.scss(未编译) -目录.scss(未汇编)
- 3 回答
- 0 关注
- 2034 浏览
添加回答
举报
0/150
提交
取消