Registry / devops / laravel-elixir-minify-html

laravel-elixir-minify-html

JSON →
library1.0.5jsnpmunverified

Laravel Elixir extension for minifying Blade-generated HTML and static HTML files using gulp-htmlmin (which uses html-minifier). Version 1.0.5 is the latest stable release; the package has seen no updates since 2020 and is effectively in maintenance mode. Key differentiator: integrates directly with Laravel Elixir's build pipeline, allowing minification of views without separate gulp tasks. Note that Laravel Elixir itself has been superseded by Laravel Mix.

npm install laravel-elixir-minify-html
INSTALL
IMPORT
SIG · LARAVEL-ELIXIR-MIN
L
laravel-elixir-minify-html
devopsjavascriptv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
require('laravel-elixir-minify-html');
import 'laravel-elixir-minify-html'; // Not an ES module
Package uses CommonJS require; no named exports.
mix.html
Elixir(function(mix) { mix.html('src/*', 'output/'); })
const mix = require('laravel-elixir').mix; mix.html(...); // wrong: mix is not exposed as a property
The html method is registered on the Elixir mix object inside the callback.
require('laravel-elixir')
var Elixir = require('laravel-elixir');
const Elixir = require('laravel-elixir-minify-html'); // Wrong package
You must require laravel-elixir first, then the minify plugin.

Minimum working gulpfile that requires laravel-elixir, registers the minify plugin, and minifies all Blade-compiled views in storage/framework/views/.

var Elixir = require('laravel-elixir'); require('laravel-elixir-minify-html'); Elixir(function(mix) { mix.html('storage/framework/views/*', 'storage/framework/views/', { collapseWhitespace: true, removeComments: true, minifyJS: true }); });
Debug
Known issues
gotchaThe plugin only works with Laravel Elixir, which is deprecated. Use Laravel Mix instead.
fix
Migrate to Laravel Mix and use mix.minify() or the html-minifier package directly.
affects: >=1.0.0
deprecatedgulp-htmlmin is deprecated in favor of gulp-htmlmin's successor or direct html-minifier usage.
fix
Consider using html-minifier directly or gulp-htmlmin v5+.
affects: *
gotchaIf you pass options that are not supported by gulp-htmlmin, they are silently ignored.
fix
Refer to gulp-htmlmin documentation for valid options.
affects: >=1.0.0
gotchaThe watcher watches the `src` path; changes to Blade templates will not trigger re-minification unless the compiled output changes.
fix
Set src to the compiled views directory (storage/framework/views), not the Blade source.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'laravel-elixir'
Missing laravel-elixir as a dependency.
fix
Run `npm install --save-dev laravel-elixir`.
TypeError: mix.html is not a function
The plugin was not required or Elixir was not initialized correctly.
fix
Ensure you have `require('laravel-elixir-minify-html');` after requiring laravel-elixir.
ReferenceError: Elixir is not defined
Missing var/let declaration for Elixir.
fix
Add `var Elixir = require('laravel-elixir');` at the top of gulpfile.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
gulp-htmlminrequiredCore minification engine
laravel-elixirrequiredRequired to register the mix.html() method
Agent activity
7 hits · last 30 days
node
4
Resources
laravel-elixir-minify-html — npm install laravel-elixir-minify-html · libregistry