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 文件中字体url编译为css文件后url(0) #40

Closed
hanai opened this issue Jul 6, 2015 · 6 comments
Closed

scss 文件中字体url编译为css文件后url(0) #40

hanai opened this issue Jul 6, 2015 · 6 comments

Comments

@hanai
Copy link
Contributor

hanai commented Jul 6, 2015

我在a.scss文件中 import _iconfont.css,_iconfont 文件中包含字体url,生成的a.css文件中的字体url错误。

a.scss

$font-stack:    Helvetica, sans-serif;
$primary-color: #333;
@import "font/_iconfont.css";

body {
  font: 100% $font-stack;
  color: $primary-color;
}

.inline-demo {
  background: url('./a.png?__inline');
}

font/_iconfont.css

@font-face {font-family: "iconfont";
  src: url('iconfont.eot'); /* IE9*/
  src: url('iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('iconfont.woff') format('woff'), /* chrome、firefox */
  url('iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
  url('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}

编译后

a.css

@font-face {
  font-family: "iconfont";
  src: url(0);                                   <----- 错误
  /* IE9*/
  src: url(0) format('embedded-opentype'), url(0) format('woff'), url(0) format('truetype'), url(0) format('svg');
  /* iOS 4.1- */ }

body {
  font: 100% Helvetica, sans-serif;
  color: #333; }

.inline-demo {
  background: url('data:image/png;base64,isfsdgsdfsdh'); }

_iconfont.css

@font-face {font-family: "iconfont";
  src: url('/font/iconfont.eot'); /* IE9*/
  src: url('/font/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('/font/iconfont.woff') format('woff'), /* chrome、firefox */
  url('/font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
  url('/font/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}

目录结构
2015-07-06 6 55 59

@oxUnd
Copy link
Contributor

oxUnd commented Jul 7, 2015

使用

@import url('xxx.css');

嗯?

其实是这样的,你 @import 是由 sass 插件处理的,其实可能它并无法处理某些路径转换的情况。你这块只是想 import 这个资源。而不是要内嵌它,所以需要让 sass 不解析你的语句。

@hanai
Copy link
Contributor Author

hanai commented Jul 7, 2015

@xiangshouding 呃,我是想要内嵌来着,以前的话也是用的fis+fis-parser-sass没有问题,所以觉得是fis3里有点区别了?

@oxUnd
Copy link
Contributor

oxUnd commented Jul 7, 2015

上传你的例子,我看看。

@hanai
Copy link
Contributor Author

hanai commented Jul 7, 2015

@2betop
Copy link
Contributor

2betop commented Jul 7, 2015

hi,这个问题已经修复了,请更新 fis-parser-sass

@hanai
Copy link
Contributor Author

hanai commented Jul 7, 2015

ok解决

@hanai hanai closed this as completed Jul 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants