Skip to content

Commit

Permalink
feat: the generated [hash] now is based on the current favicon-webpac…
Browse files Browse the repository at this point in the history
…k-plugin version
  • Loading branch information
brunocodutra authored and jantimon committed Aug 14, 2019
1 parent effb22c commit ccfea37
Show file tree
Hide file tree
Showing 54 changed files with 44 additions and 43 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dependencies": {
"cache-loader": "^2.0.1",
"camelcase": "^5.0.0",
"favicons": "^5.3.0",
"favicons": "5.3.0",
"find-cache-dir": "^2.0.0",
"find-root": "^1.1.0",
"loader-utils": "^1.2.3",
Expand All @@ -60,4 +60,4 @@
"peerDependencies": {
"webpack": "^1.13.0 || ^2.0.0 || ^3.0.0 || ^4.0.0"
}
}
}
3 changes: 2 additions & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const favicons = require('favicons');
const msgpack = require('msgpack-lite');
const { parseQuery, interpolateName } = require('loader-utils');
const { getContext } = require('./compat');
const pkg = require('../package.json')

const trailingSlash = (path) => (path.substr(-1) !== '/') ? path + '/' : path;

Expand All @@ -15,7 +16,7 @@ module.exports = function (content) {
const path = query.path && trailingSlash(query.path);
const prefix = query.prefix && trailingSlash(interpolateName(this, query.prefix, {
context: getContext(this),
content: msgpack.encode([content, query.options]), // hash must depend on logo + config
content: msgpack.encode([content, query.options, pkg.version]), // hash must depend on logo + config + version
}));

// Generate icons
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/custom/prefix/8d09875a/mstile-70x70.png"/>
<square150x150logo src="/custom/prefix/8d09875a/mstile-150x150.png"/>
<wide310x150logo src="/custom/prefix/8d09875a/mstile-310x150.png"/>
<square310x310logo src="/custom/prefix/8d09875a/mstile-310x310.png"/>
<TileColor>#fff</TileColor>

</tile>

</msapplication>

</browserconfig>
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,47 @@
"theme_color": "#fff",
"icons": [
{
"src": "/custom/prefix/5026ef56/android-chrome-36x36.png",
"src": "/custom/prefix/8d09875a/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-48x48.png",
"src": "/custom/prefix/8d09875a/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-72x72.png",
"src": "/custom/prefix/8d09875a/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-96x96.png",
"src": "/custom/prefix/8d09875a/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-144x144.png",
"src": "/custom/prefix/8d09875a/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-192x192.png",
"src": "/custom/prefix/8d09875a/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-256x256.png",
"src": "/custom/prefix/8d09875a/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-384x384.png",
"src": "/custom/prefix/8d09875a/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/custom/prefix/5026ef56/android-chrome-512x512.png",
"src": "/custom/prefix/8d09875a/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "1.0",
"name": null,
"description": null,
"icons": {
"60": "/custom/prefix/8d09875a/firefox_app_60x60.png",
"128": "/custom/prefix/8d09875a/firefox_app_128x128.png",
"512": "/custom/prefix/8d09875a/firefox_app_512x512.png"
},
"developer": {
"name": null,
"url": null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "1.0",
"api_version": 1,
"layout": {
"logo": "/custom/prefix/5026ef56/yandex-browser-50x50.png",
"logo": "/custom/prefix/8d09875a/yandex-browser-50x50.png",
"color": "#fff",
"show_title": true
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/expected/prefixed/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><link rel="shortcut icon" href="/custom/prefix/5026ef56/favicon.ico"><link rel="icon" type="image/png" sizes="16x16" href="/custom/prefix/5026ef56/favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/custom/prefix/5026ef56/favicon-32x32.png"><link rel="manifest" href="/custom/prefix/5026ef56/manifest.json"><meta name="mobile-web-app-capable" content="yes"><meta name="theme-color" content="#fff"><meta name="application-name"><link rel="apple-touch-icon" sizes="57x57" href="/custom/prefix/5026ef56/apple-touch-icon-57x57.png"><link rel="apple-touch-icon" sizes="60x60" href="/custom/prefix/5026ef56/apple-touch-icon-60x60.png"><link rel="apple-touch-icon" sizes="72x72" href="/custom/prefix/5026ef56/apple-touch-icon-72x72.png"><link rel="apple-touch-icon" sizes="76x76" href="/custom/prefix/5026ef56/apple-touch-icon-76x76.png"><link rel="apple-touch-icon" sizes="114x114" href="/custom/prefix/5026ef56/apple-touch-icon-114x114.png"><link rel="apple-touch-icon" sizes="120x120" href="/custom/prefix/5026ef56/apple-touch-icon-120x120.png"><link rel="apple-touch-icon" sizes="144x144" href="/custom/prefix/5026ef56/apple-touch-icon-144x144.png"><link rel="apple-touch-icon" sizes="152x152" href="/custom/prefix/5026ef56/apple-touch-icon-152x152.png"><link rel="apple-touch-icon" sizes="167x167" href="/custom/prefix/5026ef56/apple-touch-icon-167x167.png"><link rel="apple-touch-icon" sizes="180x180" href="/custom/prefix/5026ef56/apple-touch-icon-180x180.png"><link rel="apple-touch-icon" sizes="1024x1024" href="/custom/prefix/5026ef56/apple-touch-icon-1024x1024.png"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><meta name="apple-mobile-web-app-title"><link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" href="/custom/prefix/5026ef56/apple-touch-startup-image-320x460.png"><link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/5026ef56/apple-touch-startup-image-640x920.png"><link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/5026ef56/apple-touch-startup-image-640x1096.png"><link rel="apple-touch-startup-image" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/5026ef56/apple-touch-startup-image-750x1294.png"><link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 3)" href="/custom/prefix/5026ef56/apple-touch-startup-image-1182x2208.png"><link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 3)" href="/custom/prefix/5026ef56/apple-touch-startup-image-1242x2148.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)" href="/custom/prefix/5026ef56/apple-touch-startup-image-748x1024.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)" href="/custom/prefix/5026ef56/apple-touch-startup-image-768x1004.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/5026ef56/apple-touch-startup-image-1496x2048.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/5026ef56/apple-touch-startup-image-1536x2008.png"><link rel="icon" type="image/png" sizes="228x228" href="/custom/prefix/5026ef56/coast-228x228.png"><meta name="msapplication-TileColor" content="#fff"><meta name="msapplication-TileImage" content="/custom/prefix/5026ef56/mstile-144x144.png"><meta name="msapplication-config" content="/custom/prefix/5026ef56/browserconfig.xml"><link rel="yandex-tableau-widget" href="/custom/prefix/5026ef56/yandex-browser-manifest.json"></head><body></body></html>
<!doctype html><html><head><link rel="shortcut icon" href="/custom/prefix/8d09875a/favicon.ico"><link rel="icon" type="image/png" sizes="16x16" href="/custom/prefix/8d09875a/favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/custom/prefix/8d09875a/favicon-32x32.png"><link rel="manifest" href="/custom/prefix/8d09875a/manifest.json"><meta name="mobile-web-app-capable" content="yes"><meta name="theme-color" content="#fff"><meta name="application-name"><link rel="apple-touch-icon" sizes="57x57" href="/custom/prefix/8d09875a/apple-touch-icon-57x57.png"><link rel="apple-touch-icon" sizes="60x60" href="/custom/prefix/8d09875a/apple-touch-icon-60x60.png"><link rel="apple-touch-icon" sizes="72x72" href="/custom/prefix/8d09875a/apple-touch-icon-72x72.png"><link rel="apple-touch-icon" sizes="76x76" href="/custom/prefix/8d09875a/apple-touch-icon-76x76.png"><link rel="apple-touch-icon" sizes="114x114" href="/custom/prefix/8d09875a/apple-touch-icon-114x114.png"><link rel="apple-touch-icon" sizes="120x120" href="/custom/prefix/8d09875a/apple-touch-icon-120x120.png"><link rel="apple-touch-icon" sizes="144x144" href="/custom/prefix/8d09875a/apple-touch-icon-144x144.png"><link rel="apple-touch-icon" sizes="152x152" href="/custom/prefix/8d09875a/apple-touch-icon-152x152.png"><link rel="apple-touch-icon" sizes="167x167" href="/custom/prefix/8d09875a/apple-touch-icon-167x167.png"><link rel="apple-touch-icon" sizes="180x180" href="/custom/prefix/8d09875a/apple-touch-icon-180x180.png"><link rel="apple-touch-icon" sizes="1024x1024" href="/custom/prefix/8d09875a/apple-touch-icon-1024x1024.png"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><meta name="apple-mobile-web-app-title"><link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" href="/custom/prefix/8d09875a/apple-touch-startup-image-320x460.png"><link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/8d09875a/apple-touch-startup-image-640x920.png"><link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/8d09875a/apple-touch-startup-image-640x1096.png"><link rel="apple-touch-startup-image" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/8d09875a/apple-touch-startup-image-750x1294.png"><link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 3)" href="/custom/prefix/8d09875a/apple-touch-startup-image-1182x2208.png"><link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 3)" href="/custom/prefix/8d09875a/apple-touch-startup-image-1242x2148.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)" href="/custom/prefix/8d09875a/apple-touch-startup-image-748x1024.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)" href="/custom/prefix/8d09875a/apple-touch-startup-image-768x1004.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/8d09875a/apple-touch-startup-image-1496x2048.png"><link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" href="/custom/prefix/8d09875a/apple-touch-startup-image-1536x2008.png"><link rel="icon" type="image/png" sizes="228x228" href="/custom/prefix/8d09875a/coast-228x228.png"><meta name="msapplication-TileColor" content="#fff"><meta name="msapplication-TileImage" content="/custom/prefix/8d09875a/mstile-144x144.png"><meta name="msapplication-config" content="/custom/prefix/8d09875a/browserconfig.xml"><link rel="yandex-tableau-widget" href="/custom/prefix/8d09875a/yandex-browser-manifest.json"></head><body></body></html>

0 comments on commit ccfea37

Please sign in to comment.