Rollup plugin to generating favicons and their associated files.
It uses the favicons generator under the hood.
This plugin was inspired by the favicons-webpack-plugin.
The plugin can be used alongside the rollup-plugin-html2.
In this case rollup-plugin-favicons
should be placed before rollup-plugin-html2
in the plugin list.
By default, the plugin uses the Rollup assets emission mechanism. This means that all generated favicons and manifests will be placed under the Rollup output directory. If you need a custom output directory you can use the callback property.
npm i -D rollup-plugin-favicons
// rollup.config.js
import favicons from 'rollup-plugin-favicons'
import html2 from 'rollup-plugin-html2'
export default {
input: 'index.js',
output: {
dir: 'dist',
format: 'es',
},
plugins: [
favicons({
source: 'icon.svg',
configuration: {
appName: process.env.npm_package_displayName,
},
}),
html2({
template: 'index.html',
}),
],
}
string
A path to a source image which would be used to generate icons.
object
A configuration for the favicons. For details please read the link.
boolean | string | undefined
'node_modules/.cache/favicons'
Where to cache generated favicons and manifests or not.
Set to true
or undefined
to use the default cache location or set a custom path.
(response: object) => void | undefined
A custom callback that takes a response of favicons generator. See example.