Skip to content

使用edp webserver同步字体项目到本地

mkwiser edited this page Nov 18, 2015 · 2 revisions

百度字体编辑器支持从线上同步字体到本地,edp-webserver或者edpx-mobile最新版本增加了对字体同步的支持,具体设置如下。 在font.baidu.com字体项目中设置接受字体文件的服务地址: 同步字体

edp-webserver-config.js中增加以下配置:

{
    location: /\.font(?:$|\?)/,
    handler: [
        fontsync({
            // fontName: 'fonteditor', // 接收字体的名字
            // fontType: 'ttf,woff', // 接收字体的类型
            // fontPath: 'src/common/css/fonts' // 字体存放目录
        })
    ]
},

如果使用edpx-mobile开发,则可以支持字体同步livereload,配置edp-watch-config.js,增加监控类型:

var commonFilters = {
    staticFiles: '*.(tpl|html|js|coffee|less|styl|css|xml)',
    mediaFiles: '*.(gif|jpg|jpeg|png|swf|fla|mp3|ttf|woff|woff2)' 
    // 增加ttf和woff监控
};
Clone this wiki locally