grunt 构建
安装
npm install grunt-font-spider --save-dev
书写css
/*声明 WebFont*/
@font-face {
font-family: 'pinghei';
src: url('../font/pinghei.eot');
src:
url('../font/pinghei.eot?#font-spider') format('embedded-opentype'),
url('../font/pinghei.woff') format('woff'),
url('../font/pinghei.ttf') format('truetype'),
url('../font/pinghei.svg') format('svg');
font-weight: normal;
font-style: normal;
}
/*使用选择器指定字体*/
.home h1, .demo > .test {
font-family: 'pinghei';
}
配置示例
module.exports = function(grunt) {
grunt.initConfig({
// 拷贝文件到发布目录,这样字体可被反复处理
copy: {
main: {
src: './test/**',