Skip to content

Minify the HTML that gets generated by your Blade template files or just static HTML files with Laravel Elixir.

License

Notifications You must be signed in to change notification settings

mercuryseries/laravel-elixir-minify-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Elixir HTML minify

This package allows you to minify static HTML files or the HTML that gets generated by your Blade template files. It works very well and is very configurable. It uses gulp-htmlmin, which uses html-minifier.

Installation

First you need to install this package.

npm install --save-dev laravel-elixir-minify-html

Then require this package into your gulpfile.js.

var Elixir = require('laravel-elixir');
require('laravel-elixir-minify-html');

Then call the html method from your mix.

The html method can take up to three arguments:

  1. src (required): The files to minify.
  2. outputPath (optional): The output folder (defaults to storage/framework/views).
  3. options (optional): Options object passed to the gulp-htmlmin task.

This task defines a watcher for the path defined in src.

Sample code:

Elixir(function(mix) {
    mix.html('storage/framework/views/*', 'storage/framework/views/', {collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, minifyJS: true});
});

About

Minify the HTML that gets generated by your Blade template files or just static HTML files with Laravel Elixir.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published