Grunt Sass编译问题

时间:2015-08-07 13:51:20

标签: css sass gruntjs grunt-contrib-compass

我在main.css中有我的所有sass文件,由grunt编译。

结构如下:

main.scss

/* Extended CSS */
@import '_extend.scss';

/* Generic CSS */
@import 'general.scss';

/* View based CSS */
@import 'create-obj.scss';
@import 'css2.scss';

/* Module based CSS **/
@import 'css3.scss';

_extend.scss

%width-100 {
    width: 100%;
}

创建-obj.scss

ul.form-fields {
> li {
    @extend %width-100;
    @extend %float-l;
    position: relative;
    input {
        padding-right: 160px;
    }
}
}

当它被grunt编译时,我收到以下错误:

Running "compass:server" (compass) task
error src/main/webapp/assets/scss/create-obj.scss (Line 14: "ul.form-fields > li" failed to @extend "%width-100".
The selector "%width-100" was not found.
Use "@extend %width-100 !optional" if the extend should be able to fail.
)
write src/main/webapp/assets/css/main.css (0.049s)
Compilation failed in 1 files.
Warning: ↑ Use --force to continue.

因警告而中止。

当我重新保存_extend.scss时,它就会成功。

简而言之,每当我在css1.scss中添加一些css并保存它时。 Grunt给了我编译错误,然后我需要保存_extend.scss来完成编译。

感谢任何反馈。

0 个答案:

没有答案