Skip to content

Commit dd95a78

Browse files
committed
chore: simplify svg regex
1 parent 7cbbccf commit dd95a78

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/rollup-plugin-html/src/output/emitAssets.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export interface EmittedAssets {
1212
}
1313

1414
const allowedFileExtensions = [
15-
// https://www.w3.org/TR/html4/types.html#:~:text=ID%20and%20NAME%20tokens%20must,tokens%20defined%20by%20other%20attributes.
16-
/.*\.svg(#[A-Za-z][A-Za-z0-9\-_:.]*)?/,
15+
/.*\.svg/,
1716
/.*\.png/,
1817
/.*\.jpg/,
1918
/.*\.jpeg/,
@@ -93,9 +92,10 @@ export async function emitAssets(
9392
visitor: {
9493
Url: url => {
9594
// Support foo.svg#bar
95+
// https://www.w3.org/TR/html4/types.html#:~:text=ID%20and%20NAME%20tokens%20must,tokens%20defined%20by%20other%20attributes.
9696
const [filePath, idRef] = url.url.split('#');
9797

98-
if (shouldHandleAsset(url.url)) {
98+
if (shouldHandleAsset(filePath)) {
9999
// Read the font file, get the font from the source location on the FS using asset.filePath
100100
const assetLocation = path.resolve(path.dirname(asset.filePath), filePath);
101101
const assetContent = fs.readFileSync(assetLocation);

0 commit comments

Comments
 (0)