All Projects → nckg → laravel-minify-html

nckg / laravel-minify-html

Licence: other
Very, very simple HTML minifier with Laravel support

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to laravel-minify-html

RazorHtmlMinifier.Mvc5
↘️ Trivial compile-time Razor HTML Minifier for ASP.NET MVC 5.
Stars: ✭ 31 (+121.43%)
Mutual labels:  html-minifier, minifier
MinifyAll
A 𝗩𝗦𝗖𝗼𝗱𝗲 𝗺𝗶𝗻𝗶𝗳𝗶𝗲𝗿 for JS, JSON/C, CSS, and HTML, you will love its simplicity! 🌟 𝘾𝙤𝙢𝙥𝙧𝙚𝙨𝙨 and 𝙜𝙯𝙞𝙥 files and folders 📦 Reduce your bundle and file sizes with lightning speed ⚡
Stars: ✭ 54 (+285.71%)
Mutual labels:  minifier
Minify
Go minifiers for web formats
Stars: ✭ 2,824 (+20071.43%)
Mutual labels:  minifier
Minify
CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.
Stars: ✭ 1,710 (+12114.29%)
Mutual labels:  minifier
Esbuild
An extremely fast JavaScript and CSS bundler and minifier
Stars: ✭ 29,374 (+209714.29%)
Mutual labels:  minifier
Csso
CSS minifier with structural optimizations
Stars: ✭ 3,465 (+24650%)
Mutual labels:  minifier
minformat
gominfmt makes the Go code more compact to aid further compression; revert with gofmt
Stars: ✭ 19 (+35.71%)
Mutual labels:  minifier
imagemin-power-cli
Optimize (compress) images with power using imagemin 💪
Stars: ✭ 13 (-7.14%)
Mutual labels:  minifier
parcel-css
A CSS parser, transformer, and minifier written in Rust.
Stars: ✭ 1,856 (+13157.14%)
Mutual labels:  minifier
vbsmin
VBScript minifier
Stars: ✭ 19 (+35.71%)
Mutual labels:  minifier
hasmin
Hasmin - A Haskell CSS Minifier
Stars: ✭ 55 (+292.86%)
Mutual labels:  minifier
asset-mix
Provides helpers functions for CakePHP to use Laravel Mix.
Stars: ✭ 27 (+92.86%)
Mutual labels:  minifier
MinifyAllCli
📦 A lightweight, simple and easy npm tool to 𝗺𝗶𝗻𝗶𝗳𝘆 JSON/C, HTML and CSS! Also known as MinifyAll core! ⭐ Usable as 𝑪𝑳𝑰 tool or 𝒊𝒎𝒑𝒐𝒓𝒕𝒂𝒃𝒍𝒆 in TS/JS as a 𝑴𝑶𝑫𝑼𝑳𝑬 🥰
Stars: ✭ 21 (+50%)
Mutual labels:  minifier

HTML minifier

Build Status Packagist Packagist codecov

Introduction

Very, very simple html minifier with Laravel 5.x support.

It minifies HTML by

  1. removing HTML comments except IE conditions
  2. removing comments
  3. shorten multiple white spaces
  4. removing whitespaces between HTML tags
  5. collapsing new lines

You should end up with a small size profit:

Uniminfied Minified
64.2KB 44.6KB

Code Samples

$input = "<a href="/foo" class="bar  moo        ">Hello World</a>";
$minifier = new Minifier();
$output = $minifier->html($string); // <a href="https://github.com/foo" class="bar moo ">Hello World</a>

Installation

You can install the package via composer:

composer require nckg/laravel-minify-html

If you are using Laravel you can add the middleware to your middleware providers

// app/Http/Kernel.php
/**
 * The application's global HTTP middleware stack.
 *
 * @var array
 */
protected $middleware = [
    ...
    \Nckg\Minify\Middleware\MinifyResponse::class,
];

Testing

composer test

License

The MIT License (MIT).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].