NAME

Mojolicious::Plugin::AssetPack::Pipe::Favicon - Generate favicons

SYNOPSIS

Application

plugin AssetPack => {pipes => ["Favicon"]};
app->asset->pipe("Favicon")->api_key("fd27cc5654345678765434567876545678765556");
app->asset->process("favicon.ico" => "images/favicon.png");

# Can also register variations of the favicon:
app->asset->process("favicon.variant1.ico" => "images/favicon1.png");
app->asset->process("favicon.variant2.ico" => "images/favicon2.png");

Note that the topic must be either "favicon.ico" or "favicon.some_identifier.ico".

The input image file should be a 260x260 PNG file for optimal results.

Template

%= 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.

DESCRIPTION

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.

ATTRIBUTES

api_key

$self = $self->api_key($key);
$str = $self->api_key;

An API key obtained from http://realfavicongenerator.net/api/.

design

$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.

settings

$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.

METHODS

process

See "process" in Mojolicious::Plugin::AssetPack::Pipe.

SEE ALSO

http://realfavicongenerator.net.

https://css-tricks.com/favicon-quiz/.

Mojolicious::Plugin::AssetPack.