Skip to content

marfalkov/laravel-real-favicon

Repository files navigation

laravel-real-favicon

favicon generation using realfavicongenerator.net

npm version

What does this package do?

  1. Upon installation it creates a new entry in your package.json's scripts section:
{
  "scripts": {
    "generate-favicon": "node node_modules/@marfalkov/laravel-real-favicon/index.js"
  },
}
  1. Once your single source image file is ready it will generate your favicons from it.

  2. It generates a partial in resources/views/partials/favicon.blade.php

  3. It inserts an include after your meta tags into resources/views/app.blade.php:

@include('partials.favicon')

The reasoning behind this package

When do you need to generate favicons for a site? Probably when you are in the early stage of development and have the original favicon source file ready. Then later when you want to change the favicon. A laravel mix task is not an ideal solution for this purpose, so I decided to take a different approach. This task is a perfect match for an npm script that you can use only when you need it, instead of polluting your webpack.mix.js.

Usage

npm install --save-dev @marfalkov/laravel-real-favicon
  1. Put your single favicon source image file with .jpg, .png or .svg extension to /resources/favicon/original/

  2. Make sure you have an app.blade.php in resources/views If you wish to have your main layout elsewhere or name it other than app.blade.php you can change it in resources/favicon/config/options.json

npm run generate-favicon
  1. Enjoy your generated favicons!

  2. When you need to change your favicon just replace the original in resources/favicon/original and npm run generate-favicon

Issues

Github Issues

Credits

Webapix (Send those guys a postcard, they love postcards!)

shelljs

npm-add-script

gulp-real-favicon

TODO's

  • clean up code
  • write tests
  • add git hooks
  • add release-it

Development

npm install --ignore-scripts

License: MIT

About

favicon generation using realfavicongenerator.net

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published