gulp-iconfont-css를 사용하여 Material Design svg를 글꼴로 컴파일하려고합니다.사용자 정의 아이콘 글꼴이로드되지 않았습니다
gulp.task('iconfont', function(){
gulp.src(paths.svg)
.pipe(iconfontCss({
fontName: 'material-design', // required
path: './www/sass/templates/_icons.scss',
targetPath: '../sass/_icons.scss',
fontPath: '/fonts/'
})).pipe(iconfont({
fontName: 'material-design', // required
}))
.pipe(gulp.dest('./www/fonts/'));
});
그리고 지금 내 템플릿 :
@font-face {
font-family: "<%= fontName %>";
src: url('<%= fontPath %><%= fontName %>.eot');
src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
url('<%= fontPath %><%= fontName %>.woff') format('woff'),
url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
}
.icon:before {
font-family: "<%= fontName %>";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-style: normal;
font-variant: normal;
font-weight: normal;
// speak: none; // only necessary if not using the private unicode range (firstGlyph option)
text-decoration: none;
text-transform: none;
}
<% _.each(glyphs, function(glyph) { %>
<% var array = glyph.fileName.split('_') %>
.icon-<%= array.slice(1, array.length - 1).join('-') %>:before {
content: "\<%= glyph.codePoint %>";
}
<% }); %>
문제 : 이것은 내 Gulpfile.js의 일부입니다 나는이 같은 요소를 만들 때 내 아이콘로드되지 않습니다
<i class="icon-send"></i>
을
아무 것도 볼 수 없습니다. 그리고 글꼴은 서버 (네트워크 로그에 있음)에 다운로드되지 않습니다. 또한 아이콘은 두 번 다른 값으로 정의됩니다. 추출 :
@font-face {
font-family: "material-design";
src: url('/fonts/material-design.eot');
src: url('/fonts/material-design.eot?#iefix') format('eot'), url('/fonts/material-design.woff') format('woff'), url('/fonts/material-design.ttf') format('truetype'), url('/fonts/material-design.svg#material-design') format('svg'); }
.icon:before {
font-family: "material-design";
...
text-transform: none; }
.icon-3d-rotation:before {
content: "\E001"; }
.icon-3d-rotation:before {
content: "\E002"; }
.icon-accessibility:before {
content: "\E003"; }
.icon-accessibility:before {
content: "\E004"; }
당신은 글꼴의 경로가 올바른지 확인 했습니까? 또는 생성 된 CSS가 유효합니까? – cimmanon
이것은 생성 된 css 파일입니다 https://gist.github.com/vinz243/7f793f97d359bc8e4152 어떤 글꼴에 대한 404 또는 임의의 요청이 없습니다 (roboto 제외) – Vinz243