Gathering detailed insights and metrics for favicons-webpack-plugin
Gathering detailed insights and metrics for favicons-webpack-plugin
Gathering detailed insights and metrics for favicons-webpack-plugin
Gathering detailed insights and metrics for favicons-webpack-plugin
webpack-favicons
Webpack plugin to generate favicons for devices and browsers
favicons-webpack-plugin-ssr
Let webpack generate all your favicons and icons for you
@types/favicons-webpack-plugin
Stub TypeScript definitions entry for favicons-webpack-plugin, which provides its own types definitions
favicons-webpack-plugin-ex
Let webpack generate all your favicons and icons for you
Let webpack generate all your favicons and icons for you
npm install favicons-webpack-plugin
Typescript
Module System
Min. Node Version
Node Version
NPM Version
56.1
Supply Chain
69.8
Quality
75.9
Maintenance
100
Vulnerability
92.3
License
JavaScript (97.84%)
HTML (2.16%)
Total Downloads
24,213,172
Last Day
12,992
Last Week
75,393
Last Month
331,236
Last Year
3,833,970
1,206 Stars
349 Commits
210 Forks
13 Watching
3 Branches
29 Contributors
Minified
Minified + Gzipped
Latest Version
6.0.1
Package Id
favicons-webpack-plugin@6.0.1
Unpacked Size
51.70 kB
Size
13.66 kB
File Count
14
NPM Version
8.19.2
Node Version
18.13.0
Publised On
13 Aug 2023
Cumulative downloads
Total Downloads
Last day
-2%
12,992
Compared to previous day
Last week
-8.7%
75,393
Compared to previous week
Last month
0.8%
331,236
Compared to previous month
Last year
-14%
3,833,970
Compared to previous year
4
17
1
Leverages on favicons to automatically generate your favicons for you.
Install the plugin and favicons with npm:
1$ npm install --save-dev favicons favicons-webpack-plugin
Add your base logo as logo.png
file to you webpack context folder.
(By default the context is the current working directory)
Add the plugin to your webpack config as follows:
1const FaviconsWebpackPlugin = require('favicons-webpack-plugin') 2 3plugins: [ 4 new FaviconsWebpackPlugin() 5]
Add the plugin to your webpack config as follows:
1const FaviconsWebpackPlugin = require('favicons-webpack-plugin') 2 3... 4 5plugins: [ 6 new FaviconsWebpackPlugin('/path/to/logo.png') // svg works too! 7]
The default configuration will automatically generate webapp manifest files along with
44 different icon formats
as appropriate for iOS devices, Android devices, Windows Phone and various desktop browsers out of your single logo.png
.
Tip: You might want to fine tune what vendors to support.
Under the hood, Webpack resolves the path to logo according to the following rules:
If /path/to/logo
is absolute, there is nothing to resolve and the path
specified is used as is.
If ./path/to/logo
is relative, it's resolved with respect to Webpack's
context
,
which defaults to process.cwd()
.
If path/to/logo
is neither explicitly relative nor absolute,
Webpack attempts to resolve it according to
resolve.modules
,
which defaults to modules: ["node_modules"]
.
In combination with html-webpack-plugin it will also inject the necessary html for you:
1<link rel="apple-touch-icon" sizes="57x57" href="/assets/apple-touch-icon-57x57.png"> 2<link rel="apple-touch-icon" sizes="60x60" href="/assets/apple-touch-icon-60x60.png"> 3<link rel="apple-touch-icon" sizes="72x72" href="/assets/apple-touch-icon-72x72.png"> 4<link rel="apple-touch-icon" sizes="76x76" href="/assets/apple-touch-icon-76x76.png"> 5<link rel="apple-touch-icon" sizes="114x114" href="/assets/apple-touch-icon-114x114.png"> 6<link rel="apple-touch-icon" sizes="120x120" href="/assets/apple-touch-icon-120x120.png"> 7<link rel="apple-touch-icon" sizes="144x144" href="/assets/apple-touch-icon-144x144.png"> 8<link rel="apple-touch-icon" sizes="152x152" href="/assets/apple-touch-icon-152x152.png"> 9<link rel="apple-touch-icon" sizes="167x167" href="/assets/apple-touch-icon-167x167.png"> 10<link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon-180x180.png"> 11<link rel="apple-touch-icon" sizes="1024x1024" href="/assets/apple-touch-icon-1024x1024.png"> 12<link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" href="/assets/apple-touch-startup-image-320x460.png"> 13<link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)" href="/assets/apple-touch-startup-image-640x920.png"> 14<link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" href="/assets/apple-touch-startup-image-640x1096.png"> 15<link rel="apple-touch-startup-image" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" href="/assets/apple-touch-startup-image-750x1294.png"> 16<link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 3)" href="/assets/apple-touch-startup-image-1182x2208.png"> 17<link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 3)" href="/assets/apple-touch-startup-image-1242x2148.png"> 18<link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 1)" href="/assets/apple-touch-startup-image-748x1024.png"> 19<link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" href="/assets/apple-touch-startup-image-1496x2048.png"> 20<link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 1)" href="/assets/apple-touch-startup-image-768x1004.png"> 21<link rel="apple-touch-startup-image" media="(device-width: 768px) and (device-height: 1024px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" href="/assets/apple-touch-startup-image-1536x2008.png"> 22<link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png"> 23<link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png"> 24<link rel="icon" type="image/png" sizes="228x228" href="/assets/coast-228x228.png"> 25<link rel="manifest" href="/assets/manifest.webmanifest"> 26<link rel="shortcut icon" href="/assets/favicon.ico"> 27<link rel="yandex-tableau-widget" href="/assets/yandex-browser-manifest.json"> 28<meta name="apple-mobile-web-app-capable" content="yes"> 29<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> 30<meta name="apple-mobile-web-app-title"> 31<meta name="application-name"> 32<meta name="mobile-web-app-capable" content="yes"> 33<meta name="msapplication-TileColor" content="#fff"> 34<meta name="msapplication-TileImage" content="/assets/mstile-144x144.png"> 35<meta name="msapplication-config" content="/assets/browserconfig.xml"> 36<meta name="theme-color" content="#fff">
https://github.com/jantimon/favicons-webpack-plugin/blob/master/test/fixtures/expected/html
1plugins: [ 2 new FaviconsWebpackPlugin({ 3 // Your source logo (required) 4 logo: './src/logo.png', 5 // Your maskable source logo (optional) 6 logoMaskable: './src/logo-maskable.png', 7 // Allow caching the assets across webpack builds. By default this will use 8 // webpack's cache configuration, but can be set to false to disable caching. 9 // Note: disabling caching may increase build times considerably. 10 // For more information, see: https://webpack.js.org/configuration/cache/ 11 cache: true, 12 // Override the publicPath option usually read from webpack configuration 13 publicPath: '/static', 14 // The directory to output the assets relative to the webpack output dir. 15 // Relative string paths are allowed here ie '../public/static'. If this 16 // option is not set, `prefix` is used. 17 outputPath: '/public/static', 18 // Prefix path for generated assets 19 prefix: 'assets/', 20 // Inject html links/metadata (requires html-webpack-plugin). 21 // This option accepts arguments of different types: 22 // * boolean 23 // `false`: disables injection 24 // `true`: enables injection if that is not disabled in html-webpack-plugin 25 // * function 26 // any predicate that takes an instance of html-webpack-plugin and returns either 27 // `true` or `false` to control the injection of html metadata for the html files 28 // generated by this instance. 29 inject: true, 30 31 // Favicons configuration options (see below) 32 favicons: { 33 ... 34 } 35 }) 36]
To fine tune what icons/metadata is generated, refer to favicons' documentation.
The options specified under favicons:
are handed over as is to favicons,
except that if appName
, appDescription
, version
, developerName
or
developerURL
are left undefined
, they will be automatically inferred
respectively from name
, description
, version
, author.name
and
author.url
as defined in the nearest package.json
if available.
To disable automatically retrieving metadata from package.json
, simply set
to null
the properties you want to omit.
1const FaviconsWebpackPlugin = require('favicons-webpack-plugin') 2 3plugins: [ 4 new FaviconsWebpackPlugin({ 5 logo: './src/logo.png', // svg works too! 6 mode: 'webapp', // optional can be 'webapp', 'light' or 'auto' - 'auto' by default 7 devMode: 'webapp', // optional can be 'webapp' or 'light' - 'light' by default 8 favicons: { 9 appName: 'my-app', 10 appDescription: 'My awesome App', 11 developerName: 'Me', 12 developerURL: null, // prevent retrieving from the nearest package.json 13 background: '#ddd', 14 theme_color: '#333', 15 icons: { 16 coast: false, 17 yandex: false 18 } 19 } 20 }) 21]
To fine tune what icons/metadata is generated, refer to favicons' documentation.
1const FaviconsWebpackPlugin = require('favicons-webpack-plugin') 2const HtmlWebpackPlugin = require('html-webpack-plugin') 3const { basename } = require('path') 4 5... 6 7plugins: [ 8 new HtmlWebpackPlugin({ 9 template: 'a.html.tmpl', 10 filename: 'a.html', 11 }), 12 new HtmlWebpackPlugin({ 13 template: 'b.html.tmpl', 14 filename: 'b.html', 15 }), 16 new FaviconsWebpackPlugin({ 17 logo: 'logo.svg', 18 inject: htmlPlugin => 19 basename(htmlPlugin.options.filename) === 'a.html', 20 }), 21],
Modes allow you to choose a very fast simplified favicon compilation or a production ready favicon compilation
By default or if the favicons mode option is set to auto
the favicon compilation depends on the webpack mode:
If the webpack mode is set to development
the favicons mode will use a quick light
favicons build.
If the webpack mode is set to production
the favicons mode will use a full webapp
favicons build.
This behaviour can be adjusted by setting the favicons mode
and devMode
options.
The manifest options allows to overwrite values of the generated manifest.webmanifest with own values
1const FaviconsWebpackPlugin = require('favicons-webpack-plugin') 2 3plugins: [ 4 new FaviconsWebpackPlugin({ 5 logo: './src/logo.png', 6 mode: 'webapp', 7 manifest: './src/manifest.webmanifest' 8 }) 9]
favicons-webpack-plugin 2.x is compatible with html-webpack-plugin 3.x
favicons-webpack-plugin 3.x - 4.x is compatible with html-webpack-plugin 4.x
favicons-webpack-plugin 5.x - 6.x is compatible with html-webpack-plugin 5.x
Take a look at the CHANGELOG.md.
You're free to contribute to this project by submitting issues and/or pull requests.
Please keep in mind that every change and new feature should be covered by tests.
This project is licensed under MIT.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/23 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-02
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More