Mojolicious::Plugin::AssetPack::Pipe::Favicon - Generate favicons
plugin AssetPack => {pipes => ["Favicon"]}; app->asset->pipe("Favicon")->api_key("fd27cc5654345678765434567876545678765556"); app->asset->process("favicon.ico" => "images/favicon.png");
Note that the topic must be "favicon.ico".
The input image file should be 260x260 for optimal results.
%= asset "favicon.ico"
The above template will expand to whatever HTML that http://realfavicongenerator.net has generated, based on "design". Example:
<link rel="icon" type="image/png" href="/asset/52eaz7613a/favicon-16x16.png" sizes="16x16"> <link rel="icon" type="image/png" href="/asset/65428718f1/favicon-32x32.png" sizes="32x32"> <link rel="apple-touch-icon" sizes="114x114" href="/asset/9aab8718f1/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="152x152" href="/asset/feee661542/apple-touch-icon-152x152.png"> <meta name="msapplication-square310x310logo" content="/asset/123ab718f1/largelogo.png"> <meta name="msapplication-wide310x150logo" content="/asset/a827bfddf0/widelogo.png">
By default this pipe will only create desktop icons. Configure "design" for more icons.
Mojolicious::Plugin::AssetPack::Pipe::Favicon uses http://realfavicongenerator.net to generate all the different favicons that is required for your site.
This pipe is EXPERIMENTAL. Let me know if you are using it.
$self = $self->api_key($key); $str = $self->api_key;
An API key obtained from http://realfavicongenerator.net/api/.
$hash = $self->design; $self = $self->design({desktop_browser => {}, ios => {}, windows => {}});
Can be used to customize the different designs. Look for "favicon_design" on http://realfavicongenerator.net/api/non_interactive_api for details.
$hash = $self->settings; $self = $self->settings({compression => 3});
Can be used to customize the different settings. Look for "settings" on http://realfavicongenerator.net/api/non_interactive_api for details.
See "process" in Mojolicious::Plugin::AssetPack::Pipe.
$bytestream = $self->render($c);
Used to render the favicons as HTML.
Add support for different icons for each platform.
http://realfavicongenerator.net.
https://css-tricks.com/favicon-quiz/.
Mojolicious::Plugin::AssetPack.
To install Mojolicious::Plugin::AssetPack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::AssetPack
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::AssetPack
For more information on module installation, please visit the detailed CPAN module installation guide.