Skip to content

Commit a2566c9

Browse files
feat: added manifest, preload and prefetch
1 parent 2482b07 commit a2566c9

File tree

7 files changed

+108
-45
lines changed

7 files changed

+108
-45
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Supported tags and attributes:
8585
- the `href` attribute of the `image` tag
8686
- the `xlink:href` attribute of the `use` tag
8787
- the `href` attribute of the `use` tag
88-
- the `href` attribute of the `link` tag when the `rel` attribute contains `stylesheet`, `icon`, `shortcut icon`, `mask-icon`, `apple-touch-icon`, `apple-touch-icon-precomposed`, `apple-touch-startup-image`
88+
- the `href` attribute of the `link` tag when the `rel` attribute contains `stylesheet`, `icon`, `shortcut icon`, `mask-icon`, `apple-touch-icon`, `apple-touch-icon-precomposed`, `apple-touch-startup-image`, `manifest`, `prefetch`, `preload`
8989
- the `content` attribute of the `meta` tag when the `name` attribute is `msapplication-tileimage`, `msapplication-square70x70logo`, `msapplication-square150x150logo`, `msapplication-wide310x150logo`, `msapplication-square310x310logo`, `msapplication-config` or when the `property` attribute is `og:image`, `og:image:url`, `og:image:secure_url`, `og:audio`, `og:audio:secure_url`, `og:video`, `og:video:secure_url`, `vk:image`
9090

9191
#### `Boolean`

src/utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,12 @@ function linkHrefFilter(tag, attribute, attributes) {
559559
'apple-touch-icon',
560560
'apple-touch-icon-precomposed',
561561
'apple-touch-startup-image',
562+
'manifest',
563+
'prefetch',
564+
'preload',
562565
];
563566

564-
return allowedRels.filter((value) => usedRels.includes(value));
567+
return allowedRels.filter((value) => usedRels.includes(value)).length > 0;
565568
}
566569

567570
function metaContentFilter(tag, attribute, attributes) {

test/__snapshots__/esModule-option.test.js.snap

Lines changed: 15 additions & 6 deletions
Large diffs are not rendered by default.

test/__snapshots__/loader.test.js.snap

Lines changed: 5 additions & 2 deletions
Large diffs are not rendered by default.

test/__snapshots__/minimize-option.test.js.snap

Lines changed: 24 additions & 15 deletions
Large diffs are not rendered by default.

test/__snapshots__/sources-option.test.js.snap

Lines changed: 56 additions & 20 deletions
Large diffs are not rendered by default.

test/fixtures/simple.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ <h2>An Ordered HTML List</h2>
150150
<link rel="shortlink" type="text/html" href="http://flic.kr/p/6XuLyD">
151151
<link type="text/css" href="./style.file.css">
152152
<link rel="pingback" href="http://bob.example.net/xmlrpcserver">
153+
<link rel="preload" href="./style.file.css">
154+
<link rel="prefetch" href="image.png">
155+
<link rel="modulepreload" href="script.js">
153156
<a rel="author" href="./simple.html">link text</a>
154157

155158
<a href="tel:1-408-555-5555">Call me</a>

0 commit comments

Comments
 (0)