Package Data | |
---|---|
Maintainer Username: | sonnn |
Maintainer Contact: | sonnn.uct@gmail.com (sonnn) |
Package Create Date: | 2017-07-27 |
Package Last Update: | 2017-07-27 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-08 03:06:41 |
Package Statistics | |
---|---|
Total Downloads: | 8 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Read my preferred way of minifying HTML in Laravel 5/5.1+ apps here: Using Gulp to Minify Laravel Blade Templates
This package compresses the HTML output from your Laravel 4 application, seamlessly reducing the overall response size of your pages.
Other scripts that I've seen will compress the HTML output on-the-fly for each request. Instead, this package extends the Blade compiler to save the compiled template files to disk in their compressed state, reducing the overhead for each request.
Even with gzip enabled, there is still an improvement in the response size for HTML content-type documents.
Test Page | w/o Gzip | w/ Gzip | w/ Gzip + Laravel HTML Minify --- | ---: | ---: | :---: #1 | 8,039 bytes | 1,944 bytes | 1,836 bytes (5.6% improvement) #2 | 377,867 bytes | 5,247 bytes | 4,314 bytes (17.8% improvement)
"sonnn/html-minify": "1.*"
to composer.json.composer update
Sonnn\HtmlMinify\LaravelHtmlMinifyServiceProvider
to the list of providers in app/config/app.php.*.blade.php
template files. Once Laravel detects a change, it will recompile them, which is when this package will go to work. To force all views to be recompiled, just run this command: find . -name "*.blade.php" -exec touch {} \;
Optionally, you can choose to customize how the minifier functions for different environments. Publish the configuration file and edit accordingly.
$ php artisan config:publish sonnn/html-minify
enabled
- boolean, default true
If you are using a javascript framework that conflicts with Blade's tags, you can change them.
blade.contentTags
- array, default {{
and }}
blade.escapedContentTags
- array, default {{{
and }}}
To prevent the minification of a view file, add skipmin
somewhere in the view.
{{-- skipmin --}}
<!-- skipmin -->