Skip to content

Commit

Permalink
Update manifest file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldietiker authored and andy128k committed Oct 25, 2022
1 parent ffb8517 commit 93d219d
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ In combination with [html-webpack-plugin](https://github.com/jantimon/html-webpa
<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="228x228" href="/assets/coast-228x228.png">
<link rel="manifest" href="/assets/manifest.json">
<link rel="manifest" href="/assets/manifest.webmanifest">
<link rel="shortcut icon" href="/assets/favicon.ico">
<link rel="yandex-tableau-widget" href="/assets/yandex-browser-manifest.json">
<meta name="apple-mobile-web-app-capable" content="yes">
Expand Down Expand Up @@ -232,7 +232,7 @@ This behaviour can be adjusted by setting the favicons `mode` and `devMode` opti

### Custom manifests

The manifest options allows to overwrite values of the generated manifest.json with own values
The manifest options allows to overwrite values of the generated manifest.webmanifest with own values

```javascript
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
Expand All @@ -241,7 +241,7 @@ plugins: [
new FaviconsWebpackPlugin({
logo: './src/logo.png',
mode: 'webapp',
manifest: './src/manifest.json'
manifest: './src/manifest.webmanifest'
})
]
```
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion example/custom-manifest/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = (env, args) => {
}),
new FaviconsWebpackPlugin({
logo: './src/favicon.png',
manifest: './src/manifest.json',
manifest: './src/manifest.webmanifest',
mode: 'webapp'

}),
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class FaviconsWebpackPlugin {
compilation.fileDependencies.add(logoMaskable);
}

// Watch for changes to the base manifest.json
// Watch for changes to the base manifest.webmanifest
if (typeof this.options.manifest === 'string') {
compilation.fileDependencies.add(this.options.manifest);
}
Expand Down Expand Up @@ -439,9 +439,9 @@ class FaviconsWebpackPlugin {

// If the manifest is not empty add it also to the light mode
if (Object.keys(baseManifest).length > 0) {
tags.push('<link rel="manifest" href="manifest.json">');
tags.push('<link rel="manifest" href="manifest.webmanifest">');
assets.push({
name: path.join(outputPath, 'manifest.json'),
name: path.join(outputPath, 'manifest.webmanifest'),
contents: new RawSource(
JSON.stringify(
mergeManifests(baseManifest, {
Expand Down Expand Up @@ -507,7 +507,7 @@ class FaviconsWebpackPlugin {
});

const modifiedFiles = files.map((file) => {
if (file.name.endsWith('manifest.json')) {
if (file.name.endsWith('manifest.webmanifest')) {
const generatedManifest = JSON.parse(file.contents);

return {
Expand Down Expand Up @@ -600,7 +600,7 @@ function getResolvedPublicPath(logoContentHash, compilation, faviconOptions) {
}

/**
* Merge two manifest.json files
* Merge two manifest.webmanifest files
*
* @param {{[key: string]: any}} manifest1
* @param {{[key: string]: any}} manifest2
Expand Down
2 changes: 1 addition & 1 deletion src/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface FaviconWebpackPlugionOptions {
* which are websites that can be installed to a device’s homescreen without an app store.
* @see https://developer.mozilla.org/en-US/docs/Web/Manifest
*
* The manifest option allows to provide a filepath to a base manifest.json file or a base manifest configuration
* The manifest option allows to provide a filepath to a base manifest.webmanifest file or a base manifest configuration
*/
manifest?: string | { [key: string]: any }
/**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/manifest.file.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('should generate a result with custom manifest values', async (t) => {
plugins: [
new FaviconsWebpackPlugin({
logo,
manifest: path.resolve(fixtures, 'manifest.json'),
manifest: path.resolve(fixtures, 'manifest.webmanifest'),
}),
],
});
Expand Down
2 changes: 1 addition & 1 deletion test/manifest.light.file.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('should generate a result with custom manifest values', async (t) => {
new FaviconsWebpackPlugin({
logo,
mode: 'light',
manifest: path.resolve(fixtures, 'manifest.json'),
manifest: path.resolve(fixtures, 'manifest.webmanifest'),
}),
],
});
Expand Down
4 changes: 2 additions & 2 deletions test/snapshots/manifest.light.file.test.mjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Generated by [AVA](https://avajs.dev).
[
'assets/favicon.png',
'assets/manifest.json',
'assets/manifest.webmanifest',
'main.js',
]

Expand All @@ -22,7 +22,7 @@ Generated by [AVA](https://avajs.dev).
content: 'png 874x989',
},
{
assetName: 'assets/manifest.json',
assetName: 'assets/manifest.webmanifest',
content: `{␊
"name": "FaviconsDemo",␊
"short_name": "FaviconsDemo",␊
Expand Down
4 changes: 2 additions & 2 deletions test/snapshots/manifest.light.test.mjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Generated by [AVA](https://avajs.dev).
[
'assets/favicon.png',
'assets/manifest.json',
'assets/manifest.webmanifest',
'main.js',
]

Expand All @@ -22,7 +22,7 @@ Generated by [AVA](https://avajs.dev).
content: 'png 874x989',
},
{
assetName: 'assets/manifest.json',
assetName: 'assets/manifest.webmanifest',
content: `{␊
"name": "FaviconsDemo",␊
"short_name": "FaviconsDemo",␊
Expand Down

0 comments on commit 93d219d

Please sign in to comment.