Skip to content

Instantly share code, notes, and snippets.

@minocoko
minocoko / FontFace load
Last active March 27, 2018 15:53
Load font async, only support woff2, woff source
function load(family, source, descriptors) {
if (typeof FontFace.prototype.load === 'function') {
return new FontFace(family, source, descriptors)
.load()
} else {
const regex = /url\((.*?)\)(.*\('(.*?)'\))?/
const srcset = source
.split(",")
.map(src => {
const matches = src.match(regex);
"husky": {
"hooks": {
"pre-push": "npm run lint:no-fix",
"post-merge": "git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD |grep package.json && yarn"
}
}