switch-favicon
v2.0.8
Published
switch favicon according to hostname
Readme
switch-favicon
Set the favicon according to the parsed sitename ( http://www.[sitename].ch). The module assumes the location of the favicon to be http://www.sitename.ch/favicon.ico but you can specify the pre- and the postfix as optional arguments.
install
npm install switch-faviconusage
e.g. with React:
import { switchFavicon } from 'switch-favicon'
...
componentDidMount() {
switchFavicon()
}
...optional arguments
| Name | Type | Description | Default
| --- | --- | --- | ---|
| verbose | String | pass 'verbose' as first argument to log to the console | ''
| locPrefix | String | part of url to favicon before the parsed hostname| 'http://www.'
| locPostfix | String | part of url to favicon after the parsed hostname. | '.ch/favicon'
call like:
import { switchFavicon } from 'switch-favicon'
switchFavicon('verbose', 'http://interaktiv.', '.ch/assets/favicon.ico')