Skip to content

Instantly share code, notes, and snippets.

View gist:a4076eea1312cb794cc24309a4064a75
"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"
}
}
@minocoko
minocoko / FontFace load
Last active Mar 27, 2018
Load font async, only support woff2, woff source
View FontFace load
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);
You can’t perform that action at this time.