Fix: css 打包方式内联 (#1375)

* fix: 文件名大小写

* fix: font load 逻辑

* fix: font 加载问题

* fix: lint error

* fix: css lib 打包配置
This commit is contained in:
@thinkinggis 2022-10-10 16:28:42 +08:00 committed by GitHub
parent f6b9938bd5
commit c878581cee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 18 deletions

View File

@ -6,6 +6,7 @@ export default {
cjs: {
output:'lib'
},
platform:'browser',
autoprefixer: {
browsers: ['IE 11', 'last 2 versions'],
},

View File

@ -172,26 +172,27 @@ export default class FontService extends EventEmitter implements IFontService {
url('${fontPath}') format('woff'),
url('${fontPath}') format('truetype');
}`;
document.getElementsByTagName('head')[0].appendChild(style);
style.onload=()=>{
if ( document.fonts) {
try {
// @ts-ignore
document.fonts.load(`24px ${fontFamily}`, 'L7text');
document.fonts.ready.then(()=>{
this.emit('fontloaded',{
fontFamily
})
})
} catch (e) {
console.warn('当前环境不支持 document.fonts !');
console.warn('当前环境不支持 iconfont !');
console.warn(e);
style.onload=()=>{
if ( document.fonts) {
try {
// @ts-ignore
document.fonts.load(`24px ${fontFamily}`, 'L7text');
document.fonts.ready.then(()=>{
this.emit('fontloaded',{
fontFamily
})
})
} catch (e) {
console.warn('当前环境不支持 document.fonts !');
console.warn('当前环境不支持 iconfont !');
console.warn(e);
}
}
}
}
document.getElementsByTagName('head')[0].appendChild(style);
}
}
public destroy(): void {

View File

@ -4,8 +4,10 @@ export default {
output:'es'
},
cjs: {
output:'lib'
},
platform:'browser',
autoprefixer: {
browsers: ['IE 11', 'last 2 versions'],
},