Skip to content

Commit 363aef5

Browse files
committed
idもindexも全部まとめてマッチさせるように
1 parent 7aef0ac commit 363aef5

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

build/gen-mplus.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,11 @@ const generateFilename = font => {
7878
const family = font['font-family'].replace(/[' ]/g, '')
7979
const weight = font['font-weight'].replace(/[' ]/g, '')
8080

81-
const fontSrcWithIndex = getUrlFromSrc(font.src).match(
82-
/\/v\d+\/[^.]+\.(\d+)\.woff2/
83-
)
84-
if (!fontSrcWithIndex) {
85-
const fontSrcWithId = getUrlFromSrc(font.src).match(
86-
/\/v\d+\/([^.]+)\.woff2/
87-
)
88-
if (!fontSrcWithId) {
89-
throw new Error(`Unexpected URL: ${getUrlFromSrc(font.src)}`)
90-
}
91-
return `${family}.${weight}.${fontSrcWithId[1]}.woff2`
81+
const fontSrcWithId = getUrlFromSrc(font.src).match(/\/v\d+\/(.+)\.woff2/)
82+
if (!fontSrcWithId) {
83+
throw new Error(`Unexpected URL: ${getUrlFromSrc(font.src)}`)
9284
}
93-
return `${family}.${weight}.${fontSrcWithIndex[1]}.woff2`
85+
return `${family}.${weight}.${fontSrcWithId[1]}.woff2`
9486
}
9587

9688
const downloadAndtransform = async (url, filename) => {

0 commit comments

Comments
 (0)