[英]How to use webfont NPM?
//app.js
const webfont = require('webfont').default;
webfont({
fontName: 'myfont',
files: './src/*.ttf',
formats: ['woff','eot']
}).then((res) => {
console.log(res);
})
node app.js 节点app.js
error: 错误:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Files glob patterns specified did not match any files. UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝ID:2):错误:指定的文件全局模式与任何文件都不匹配。
From the sourcecode: 从源代码:
var filteredFiles = foundFiles.filter(function (foundFile) {
return _path2.default.extname(foundFile) === '.svg';
});
if (filteredFiles.length === 0) {
throw new Error('Files glob patterns specified did not match any files');
}
So unfortunately you can only convert from svg. 因此很遗憾,您只能从svg转换。 You would have to change the source. 您将不得不更改源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.