0.3.4 • Published 4 years ago
laravel-mix-favicon v0.3.4
Laravel Mix Favicon
Laravel Mix extension to generate favicon and insert HTML code into your Blade file from a single PNG/JPG/SVG image using RealFaviconGenerator.
Note
When mix is running (npm run hot, e.g.), just paste your image file into the inputPath path (only PNG/JPG/SVG) which will generate favicon for your website and insert HTML code into your Blade file, if enabled*. See options for more info.
Installation
Install the extension:
npm install laravel-mix-faviconOr if you prefer yarn:
yarn add laravel-mix-faviconRequire the extension inside your Laravel Mix config and call favicon() in your pipeline:
// webpack.mix.js
const mix = require('laravel-mix');
require('laravel-mix-favicon');
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.favicon();Options
Default options
If nothing is passed to the extension inside your Laravel Mix config, the following options will be used:
{
inputPath: 'resources/favicon',
inputFile: '*.{jpg,png,svg}',
publicPath: 'public',
output: 'img/favicon',
dataFile: 'data/faviconData.json',
blade: 'resources/views/layout/favicon.blade.php',
reload: false,
debug: false,
configPath: './realfavicongenerator-config.json',
cleaner: {
use: true,
path: null,
timestamp: true
}
}Option details
inputPath(string). Your favicon data path. Generated JSON for inserting HTML code (ifbladeoption enabled) will be temporarily saved here.inputFile(string). Files to watch. It is not recommended to change this option!publicPath(string). Your application's public path.output(string). Where generated favicon will be saved. Relative to thepublicPathoption.dataFile(string). Temporary data file while generating HTML. Relative to theinputPathoption. It is not recommended to change this option!blade(string or boolean). Path to blade file, where generated HTML code will be inserted. This will overwrite whole file. Note: set this option tofalseto disabled auto-inserting HTML code.reload(boolean). Whenever to reload browser after success. Note: this option has no effect if you are using laravel-mix-blade-reload extension.debug(boolean). Whenever to log extension events messages to the console.configPath(string). File path to your RealFaviconGenerator config.cleaner(object). What to do with input file after favicon is generated. See below for more details.
Option - Cleaner (object)
use(boolean). Whenever to use cleaner after favicon is generated.path(string or null). Use "string" as path relative to theinputPathoption to save the source file in a different location. Use null to automatically remove source file.timestamp(boolean). Whenever to add timestamp as postfix to the source file before save (valid only if thecleaner.pathoption is provided as a string).
New in version 0.3.0
- Now supports
laravel-mixversion 6
New in version 0.2.2
- You can now use
cleaneroption.
New in version 0.2.0
- Laravel Mix Favicon now creates JSON file
realfavicongenerator-config.jsonin the root folder with options such asthemeColor,pictureAspect,scalingAlgorithmand more. This file will be created after first run. After updating this file you have to re-run your mix to take an effect.