2017 © Pedro Peláez
 

library html-minify

Minifies the HTML output of Laravel applications

image

sonnn/html-minify

Minifies the HTML output of Laravel applications

  • Thursday, July 27, 2017
  • by sonnn
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

UPDATE for Laravel 5/5.1+

Read my preferred way of minifying HTML in Laravel 5/5.1+ apps here: Using Gulp to Minify Laravel Blade Templates, (*1)


Laravel HTML Minify

For Laravel 4 - See here for L5+

Total Downloads, (*2)

About

This package compresses the HTML output from your Laravel 4 application, seamlessly reducing the overall response size of your pages., (*3)

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., (*4)

Why?

Even with gzip enabled, there is still an improvement in the response size for HTML content-type documents., (*5)

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)

Installation

  1. Add "sonnn/html-minify": "1.*" to composer.json.
  2. Run composer update
  3. Add Sonnn\HtmlMinify\LaravelHtmlMinifyServiceProvider to the list of providers in app/config/app.php.
  4. Important: You won't see any changes until you edit your *.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 {} \;

Config

Optionally, you can choose to customize how the minifier functions for different environments. Publish the configuration file and edit accordingly., (*6)

$ php artisan config:publish sonnn/html-minify

Options

  • enabled - boolean, default true

If you are using a javascript framework that conflicts with Blade's tags, you can change them., (*7)

  • blade.contentTags - array, default {{ and }}
  • blade.escapedContentTags - array, default {{{ and }}}

Skipping minification

To prevent the minification of a view file, add skipmin somewhere in the view., (*8)

{{-- skipmin --}}
<!-- skipmin -->

The Versions

27/07 2017

dev-master

9999999-dev https://github.com/sonnn/html-minify

Minifies the HTML output of Laravel applications

  Sources   Download

The Requires

 

The Development Requires

by Avatar sonnn

27/07 2017

v3.0

3.0.0.0 https://github.com/sonnn/html-minify

Minifies the HTML output of Laravel applications

  Sources   Download

The Requires

 

The Development Requires

by Avatar sonnn

27/07 2017

v2.0

2.0.0.0 https://github.com/sonnn/html-minify

Minifies the HTML output of Laravel applications

  Sources   Download

The Requires

 

The Development Requires

by Avatar sonnn