jdf icon indicating copy to clipboard operation
jdf copied to clipboard

scss文件编译报错说明

Open chenxiaochun opened this issue 8 years ago • 0 comments

.test {
	background :url(//img12.360buyimg.com/da/jfs/t1708/343/1355811714/2006/812516d1/55e511a9N42e564c7.jpg) no-repeat left center;
	.a{
		width: 235px;
		height: 100px;
	}
}

当你的css文件有以上类似代码时,输出时有可能会抛出以下错误:

[11:27:14] ERROR Error: Invalid CSS after "	.a": expected ")", was "{"
        on line 3 of css/popupNotice.scss
>> 	.a{
   -^

但是,请莫慌!解决办法有以下几种方式:

1、给背景图片路径添加上http协议

.test {
	background :url(http//img12.360buyimg.com/da/jfs/t1708/343/1355811714/2006/812516d1/55e511a9N42e564c7.jpg) no-repeat left center;
	.a{
		width: 235px;
		height: 100px;
	}
}

2、给背景图片路径添加上引号

.test {
	background :url('//img12.360buyimg.com/da/jfs/t1708/343/1355811714/2006/812516d1/55e511a9N42e564c7.jpg') no-repeat left center;
	.a{
		width: 235px;
		height: 100px;
	}
}

3、在background下面添加一条其它的css代码

.test {
	background :url(//img12.360buyimg.com/da/jfs/t1708/343/1355811714/2006/812516d1/55e511a9N42e564c7.jpg) no-repeat left center;
	width: 100px;
	.a{
		width: 235px;
		height: 100px;
	}
}

问题原因是由于node-sass编译引起的,目前已经反馈问题给官方作者。感谢loveky同学的反馈。

chenxiaochun avatar May 11 '17 03:05 chenxiaochun