Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scss文件编译报错说明 #10

Open
chenxiaochun opened this issue May 11, 2017 · 0 comments
Open

scss文件编译报错说明 #10

chenxiaochun opened this issue May 11, 2017 · 0 comments

Comments

@chenxiaochun
Copy link
Contributor

chenxiaochun commented May 11, 2017

.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 chenxiaochun changed the title scss文件编译报错问题 scss文件编译报错说明 May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant