File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -78,19 +78,11 @@ const generateFilename = font => {
78
78
const family = font [ 'font-family' ] . replace ( / [ ' ] / g, '' )
79
79
const weight = font [ 'font-weight' ] . replace ( / [ ' ] / g, '' )
80
80
81
- const fontSrcWithIndex = getUrlFromSrc ( font . src ) . match (
82
- / \/ v \d + \/ [ ^ . ] + \. ( \d + ) \. w o f f 2 /
83
- )
84
- if ( ! fontSrcWithIndex ) {
85
- const fontSrcWithId = getUrlFromSrc ( font . src ) . match (
86
- / \/ v \d + \/ ( [ ^ . ] + ) \. w o f f 2 /
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 + \/ ( .+ ) \. w o f f 2 / )
82
+ if ( ! fontSrcWithId ) {
83
+ throw new Error ( `Unexpected URL: ${ getUrlFromSrc ( font . src ) } ` )
92
84
}
93
- return `${ family } .${ weight } .${ fontSrcWithIndex [ 1 ] } .woff2`
85
+ return `${ family } .${ weight } .${ fontSrcWithId [ 1 ] } .woff2`
94
86
}
95
87
96
88
const downloadAndtransform = async ( url , filename ) => {
You can’t perform that action at this time.
0 commit comments