npm install grunt-font-spider --save-dev
Windows 下运行需要安装 perl 才能运行
module.exports = function(grunt) {
grunt.initConfig({
// 拷贝文件到发布目录,这样字体可被反复处理
copy: {
main: {
src: './test/**',
dest: './dest/'
},
},
// 字蛛插件:压缩与转码静态页面中的 WebFont
'font-spider': {
main: {
src: './dest/test/**/*.html'
}
}
});
grunt.loadNpmTasks('grunt-font-spider');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['copy', 'font-spider']);
};