Favicon generator for Node.js
Favicons
A Node.js module for generating favicons and their associated files. Originally built for Google's Web Starter Kit and Catalyst. Requires Node 4+. Installed through NPM with:
npm install favicons
Usage
Node.js
To use Favicons, require the appropriate module and call it, optionally specifying configuration and callback objects. A sample is shown on the right. The full list of options can be found on GitHub.
The Gulp / Grunt wrapper modules have a few extra properties. You can also configure and use Favicons from the terminal with dot syntax.
Favicons generates its icons locally using pure Javascript with no external dependencies.
Please note: Favicons is tested on Node 10.13 and above.
-- -------------------- ---- ------- --- -------- - -------------------- ------ - ---------------- -- ------ --------- --------- -------- -- ----- -- -------- ------------- - - ----- ---- -- ---- --- ---------- ------- ----- ----- -------- -------- ----- -- ---- ------------- ----- -------- ------------- ----- -- ---- ------------- ----------- --------- --------- -- --- ---- ------- ---- -- ---- --------------- ----- -- ---- ------------- ------------ -------- -------------- ----- -- ---- --- ---- ------------ ----- -------- ------------- ----- -- ---- --- ---- ------------ ---- -------- ---- ------- -- ------- ---- --------- --- ----- ----------- --- ----------- ----- -------- -- ------- -------- --- ---- --- ---------- ----------- ------- -- ---------- ------ --- --------- ------ -------- ------------ ------- -- ----- ----- ---- --- ------- -- --------- ---- --------- -------- -------------------- -------------------- -- ----- --- ----- ------ ---- -------------------- ---------- -------- -------- -------- ------------- -- --------- ------- ----- ------------- ------------- ------------ -- ---------- -------- ------------ ------ -- ------- ------------ ------ ---------- ---------- -- ------------ -------- ------ ---- -- --- -- ---- ---- --- ------- --------- ------ ---- --- ---------- ----------------- -- ----- --- ---- --------- --- ----------- ---- - ------- -------- -------- ------ -- ---- ------------- ------- ------- -------- -------- ------ -- ----- ---- -- -------- --------- ---------- ------ -- ----- ------ ------- ---- ------- --- --- ----- ---- ---- --------- -- ------- ----- ---------------------------- ------ -- -------- ----- ---- ------- ---- -------- - --------- ------ ---- -- --- ----- --------- ------ - -- -------- -------- -- - ------ - ------ -- ---------- -- - ----------- -- - ----- - --- ------- -- - ---- - ----- --- -------- ---- --- ---------- --- ------- ----- -- - ----- - --- ---------- --- --- --------- ----- -- - ---- - ----- ---- -- ----- -- ------ ------ ---- -------- -- ------- --- --------- --------- -- - ----------- - ----- ---- ------ ----- ---- --- ---- ------- -------- -- ------- --- --------- --------- -- - ------------- - ----- ---- ------ ----- ---- --- ---- ------- ---------- -- -------- ----- -- ------ ------- ---------- ----- --------- -- -- ------- ----------- ----- ------------ ------------- -- ---------- ----- -- ------ ----- ----- ------ --------- -- -- ------- ----------- ----- ------------ ------------- -- ------------- ----- -- ------ ----- ------- ------- --------- -- -- ------- ----------- ----- ------------ ------------- -- ------ ----- -- ------ ----- ----- ----- --------- -- -- ------- ----------- ----- ------------ ------------- -- --------- ----- -- ------ ------- --------- --------- -- -- ------- ----------- ----- ------------ ------------- -- -------- ----- -- ------ ------- -- ------ --------- -- -- ------- ----------- ----- ------------ ------------- -- -------- ----- -- ------ ------- - ---- ------ --------- -- -- ------- ----------- ----- ------------ ------------- -- ------- ---- -- ------ ------ ------- ----- --------- -- -- ------- ----------- ----- ------------ ------------- -- - -- -------- - -------- ------- --------- - -- ------- - --------------------------- -- ----- ----------- ---- --- ------- ----- --- --------- ------- - ----------------------------- -- ----- -- - ----- ------- --------- -------- - ---------------------------- -- ----- -- - ----- ------- --------- -------- - --------------------------- -- ----- -- ------- ----- --------- -- ---------------- -------------- ----------展开代码
You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with:
var config = require('favicons').config;
Gulp
To use Favicons with Gulp, you can either use the gulp-plugin or call it manually as follows:
-- -------------------- ---- ------- --- -------- - --------------------------- --- - --------------------- -------------------- -------- -- - ------ ------------------------------------ -------- --- ----- ------------- ------ --------------- ----- -- -- ------------- -------------- ------- --------- ------------- ---------------------------- ----------- ---------- ----- ------------ ---- ---------------------------- -------- ------------- ------------ ----------- ------ ---- ---------- ----------------- -------- ---- -------- ------ ----- ------------- --------- ----- -------- ---- --- ------------ ---- ----------------------- ---展开代码
Output
For the full list of files, check config/files.json
. For the full HTML code, check config/html.js
. Finally, for the full list of icons, check config/icons.json
.
Questions
Why are you missing certain favicons?
Because pure Javascript modules aren't available at the moment. For example, the El Capitan SVG favicon and the Windows tile silhouette ability both require SVG support. If modules for these task begin to appear, please jump on the appropriate issue and we'll get on it ASAP.
Thank you
- @haydenbleasel for this great project.
- @phbernard for all the work we did together to make Favicons and RFG awesome.
- @addyosmani, @gauntface, @paulirish, @mathiasbynens and @pbakaus for their input on multiple source images.
- @sindresorhus for his help on documentation and parameter improvements.
- Everyone who opens an issue or submits a pull request to this repo :)
Contribution
Feel free to push your code if you agree with publishing under the MIT license.
License
HomePage
https://github.com/itgalaxy/favicons
Repository
https://github.com/itgalaxy/favicons.git
来源:JavaScript中文网 ,转载请注明来源 https://www.javascriptcn.com/post/58297