Have ideas to improve npm?Join in the discussion! »

    laravel-mix-imgmin

    0.2.0 • Public • Published

    Laravel Mix imgmin

    Laravel Mix extension to compress images [png,jpg,jpeg,svg,gif,bmp,ico] with TinyPNG.

    Note

    This extension uses Gulp 4. This can create unexpected behavior if you are using older version of Gulp inside your project.

    Installation

    Install the extension:

    npm install laravel-mix-imgmin

    Or if you prefer yarn:

    yarn add laravel-mix-imgmin

    Next require the extension inside your Laravel Mix config and call imgmin() in your pipeline:

    // webpack.mix.js
    const mix = require('laravel-mix');
    require('laravel-mix-imgmin');
    
    mix.js('resources/js/app.js', 'public/js')
        .sass('resources/sass/app.scss', 'public/css')
        .imgmin();

    Options

    Default options

    If nothing is passed to the extension inside your Laravel Mix config, the following options will be used:

    {
        input: 'resources/img',
        publicPath: 'public',
        output: 'img',
        tinyPngKey: null,
        debug: false
    }

    Option details

    • input (string). Your input directory where images are located.
    • publicPath (string). Your application's public path.
    • output (string). Your output directory where compressed images will be saved.
    • tinyPngKey (string or null). Your TinyPNG key. If you don't provide TinyPNG key, then default gulp-imagemin package will be used. TinyPNG is recommended for the best results.
    • debug (boolean). Whenever to log extension events messages to the console.

    New in version 0.2.x

    • Now supports laravel-mix version 6

    Install

    npm i laravel-mix-imgmin

    DownloadsWeekly Downloads

    10

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    8.55 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar