2014-12-17 7 views
1

저는 Grunt-Contrib-Sass를 사용하고 있습니다. config.rb 파일을 어디서나 (어쨌든 하나를 만드는 경우) 찾을 수없는 것 같습니다. 나는 나침반 글꼴 얼굴 믹스 인을 사용하고 있기 때문에 나는 http_fonts_path의 경로를 할당 할 필요하며 글꼴 경로 "./fonts"Grunt-contrib-sass가 config.rb 파일을 만들지 않습니까?

이는 믹스 인 코드 반환 할 것 같다

@import "compass/css3"; 
@include font-face("Tw Cen MT", font-files("..fonts/tw_cen_mt/Tw_Cen_MT-webfont.woff", "..fonts/tw_cen_mt/Tw_Cen_MT-webfont.ttf", "..fonts/tw_cen_mt/Tw_Cen_MT-webfont.svg"), "..fonts/tw_cen_mt/Tw_Cen_MT-webfont.eot"); 
@include font-face("New Cicle Gordita", font-files("..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.woff", "..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.ttf", "..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.svg"), "..fonts/new_cicle_gordita/New_Cicle_Gordita-webfont.eot"); 

지금 여기에 내가 얻을 경고입니다 :

WARNING: 'Tw_Cen_MT-webfont.woff' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt 
WARNING: 'Tw_Cen_MT-webfont.ttf' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt 
WARNING: 'Tw_Cen_MT-webfont.svg' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt 
WARNING: 'Tw_Cen_MT-webfont.eot' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt 
WARNING: 'Tw_Cen_MT-webfont.eot?' was not found (or cannot be read) in ./fonts/..fonts/tw_cen_mt 
WARNING: 'New_Cicle_Gordita-webfont.woff' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita 
WARNING: 'New_Cicle_Gordita-webfont.ttf' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita 
WARNING: 'New_Cicle_Gordita-webfont.svg' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita 
WARNING: 'New_Cicle_Gordita-webfont.eot' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita 
WARNING: 'New_Cicle_Gordita-webfont.eot?' was not found (or cannot be read) in ./fonts/..fonts/new_cicle_gordita 

없이는 CSS 파일에서 출력에 내가 원래 말대꾸 파일 믹스 인에 넣지 어떤 경고와 동일한라고 할 수 있습니다.

".."없이 경로를 사용하면 잘 작동하지만 URL에 ./fonts를 추가하지 않습니다.

@include font-face("Tw Cen MT", font-files("/tw_cen_mt/Tw_Cen_MT-webfont.woff", "/tw_cen_mt/Tw_Cen_MT-webfont.ttf", "/tw_cen_mt/Tw_Cen_MT-webfont.svg"), "/tw_cen_mt/Tw_Cen_MT-webfont.eot"); 
@include font-face("New Cicle Gordita", font-files("/new_cicle_gordita/New_Cicle_Gordita-webfont.woff", "/new_cicle_gordita/New_Cicle_Gordita-webfont.ttf", "/new_cicle_gordita/New_Cicle_Gordita-webfont.svg"), "/new_cicle_gordita/New_Cicle_Gordita-webfont.eot"); 

그러나 CSS 파일에서 생성하고자하는 URL이 아닙니다.

답변

0

그래서 기본적으로 config.rb 파일을 프로젝트의 루트 (grunt가 실행되는 곳)에 추가했습니다.

http_fonts_path = '../fonts/' 
http_images_path = '../images/' 

relative_assets = false 

그럼, 그렇게 같은 글꼴 얼굴이나 mixin 사용을 변경 : 나는 경로가 슬래시로 시작하는 경우 "/"다음이 사용되는 것이 었습니다 깨닫게되었다 무엇

@import "compass/css3"; 
@include font-face("Tw Cen MT", font-files("tw_cen_mt/Tw_Cen_MT-webfont.woff", "tw_cen_mt/Tw_Cen_MT-webfont.ttf", "tw_cen_mt/Tw_Cen_MT-webfont.svg"), "tw_cen_mt/Tw_Cen_MT-webfont.eot"); 
@include font-face("New Cicle Gordita", font-files("new_cicle_gordita/New_Cicle_Gordita-webfont.woff", "new_cicle_gordita/New_Cicle_Gordita-webfont.ttf", "new_cicle_gordita/New_Cicle_Gordita-webfont.svg"), "new_cicle_gordita/New_Cicle_Gordita-webfont.eot"); 

직접 경로로; 그러나, 만약 내가 다른 것을 사용한다면, 그 앞에 http_fonts_path를 추가 할 것이다; 여부에 관계없이 사용자가 할당 한 기본 또는 하나.