favicons

阅读时长 15 分钟读完

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:

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:

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

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

纠错
反馈

纠错反馈