Skip to content

Commit

Permalink
feat: inline favicons with rel="shortcut icon"
Browse files Browse the repository at this point in the history
If the page is using rel="shortcut icon" instead of rel="icon", the
author will be surprised that the icon was not inlined, and may not
notice.  It would be better to inline that icon.

Includes updates to the favicon tests.

Related to issue remy#126
  • Loading branch information
joeyparrish committed Nov 17, 2016
1 parent ae4c110 commit 68c345a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var tasks = {
js: 'script',
svg: 'svg',
links: 'link[rel=stylesheet]',
favicon: 'link[rel=icon]',
favicon: 'link[rel=icon],link[rel="shortcut icon"]',
styles: 'style',
'style-attrs': '[style]:not(svg *)', // only style attrs in HTML, not SVG
images: 'img',
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/favicon.result.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>inline favicon</title> <link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX/TQBcNTh/AAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg=="> </head> <body> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>inline favicon</title> <link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX/TQBcNTh/AAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg=="> <link rel="shortcut icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEX/TQBcNTh/AAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg=="> </head> <body> </body> </html>
3 changes: 2 additions & 1 deletion test/fixtures/favicon.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<meta charset="utf-8">
<title>inline favicon</title>
<link rel="icon" type="image/png" href="colour.png">
<link rel="shortcut icon" type="image/png" href="colour.png">
</head>
<body>
</body>
</html>
</html>

0 comments on commit 68c345a

Please sign in to comment.