Registry / devops / laravel-elixir-blade-minifier

laravel-elixir-blade-minifier

JSON →
library0.0.8jsnpmunverified

Minify Laravel Blade templates within the Laravel Elixir build pipeline. This package extends Gulp-based Elixir with a `blademin` method that processes Blade files using html-minifier while preserving Blade control structures (e.g., @if, @foreach). Version 0.0.8 is the latest and only stable release; the package is no longer actively maintained. It is specific to the deprecated Laravel Elixir build system (v5+), but still functional for legacy projects. Alternatives include using Laravel Mix with a custom post-processing plugin.

npm install laravel-elixir-blade-minifier
INSTALL
IMPORT
SIG · LARAVEL-ELIXIR-BLA
L
laravel-elixir-blade-minifier
devopsjavascriptv0.0.8
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.

mix.blademin
require('laravel-elixir-blade-minifier'); elixir(function(mix) { mix.blademin('src/**/*.blade.php', 'dest/'); });
import blademin from 'laravel-elixir-blade-minifier';
This package must be required after 'laravel-elixir' and before defining the Elixir recipe. It extends the mix object, not a standalone import.
ignoreCustomFragments
mix.blademin('src/**/*.blade.php', 'dest/', { ignoreCustomFragments: [/@if.*/] });
mix.blademin('src/**/*.blade.php', 'dest/', { customAttrAssign: [/@if/] });
The html-minifier option `ignoreCustomFragments` must include all Blade directives to avoid stripping them. A full regex list is provided in the documentation.

Registers the blademin method and minifies all Blade templates from source to a separate directory.

// gulpfile.js var elixir = require('laravel-elixir'); require('laravel-elixir-blade-minifier'); elixir(function(mix) { mix.blademin('resources/views/**/*.blade.php', 'resources/views/minified/'); }); // Run `gulp` or `gulp watch` to minify
Debug
Known issues
deprecatedLaravel Elixir is deprecated in favor of Laravel Mix (since Laravel 5.4). This package only works with the original Elixir Gulp pipeline.
fix
Migrate to Laravel Mix and use a custom webpack plugin or a Blade post-processor like '@bengal/laravel-blade-minifier'.
affects: >=0.0.0
gotchaIf `ignoreCustomFragments` is not configured, Blade directives like @if, @foreach will be stripped or mangled, breaking the template.
fix
Always pass the full regex array shown in the README as html-minifier options.
affects: >=0.0.0
gotchaThe package requires Node.js and Gulp; it does not work with newer Laravel Mix (Webpack) or Vite setups.
fix
Use an alternative minifier compatible with your build system (e.g., 'laravel-mix-blade-minify').
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'blademin' of undefined
The package was required before or without requiring 'laravel-elixir'.
fix
Always require 'laravel-elixir' first, then require this package.
ReferenceError: elixir is not defined
The `elixir` function is not available because 'laravel-elixir' is not installed or required.
fix
Run `npm install laravel-elixir --save-dev` and add `var elixir = require('laravel-elixir');` at the top of gulpfile.js.
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies
laravel-elixirrequiredRequired as the build system; this package registers a mix command within Elixir's Gulp pipeline.
html-minifierrequiredUnderlying minification engine used to compress Blade templates.
Agent activity
7 hits · last 30 days
node
4
Resources
laravel-elixir-blade-minifier — npm install laravel-elixir-blade-minifier · libregistry