All Projects → middlewares → minifier

middlewares / minifier

Licence: MIT license
Middleware to minify Html, CSS and Javascript responses

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to minifier

LaraOutPress
This is simply compress your final out of Larvel Application and serve to the browser.
Stars: ✭ 56 (+273.33%)
Mutual labels:  minify, compress
uglify
PHP wrapper to execute uglify-js/clean-css node package or fallback to PHP alternatives
Stars: ✭ 16 (+6.67%)
Mutual labels:  uglify, minify
Terser Webpack Plugin
Terser Plugin
Stars: ✭ 1,687 (+11146.67%)
Mutual labels:  uglify, minify
csso-webpack-plugin
CSSO full restructuring minification files to serve your webpack bundles
Stars: ✭ 104 (+593.33%)
Mutual labels:  minify, compress
Babel Plugin Const Enum
Transform TypeScript `const` enums
Stars: ✭ 38 (+153.33%)
Mutual labels:  minify, compress
Tiny Html Minifier
Minify HTML in PHP with just a single class
Stars: ✭ 114 (+660%)
Mutual labels:  minify, compress
Html Minifier Terser
actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code
Stars: ✭ 106 (+606.67%)
Mutual labels:  minify, compress
phaser-typescript-webpack
Another Phaser CE boilerplate using TypeScript and Webpack.
Stars: ✭ 17 (+13.33%)
Mutual labels:  uglify, minify
gulp-uglifycss
Gulp plugin to use uglifycss
Stars: ✭ 24 (+60%)
Mutual labels:  uglify
frontend-starter-kit-with-gulp
Frontend Starter Kit with Gulp for either Themeforest Projects or customizable projects.
Stars: ✭ 34 (+126.67%)
Mutual labels:  minify
RecordVideo
视频录制压缩
Stars: ✭ 47 (+213.33%)
Mutual labels:  compress
ZipArchive
A single-class pure VB6 library for zip with ASM speed
Stars: ✭ 38 (+153.33%)
Mutual labels:  compress
pclzip-doc-zh-cn
PHP 库 PclZip 的简体中文翻译文档(zh-cn translation for PHP lib: PclZip)
Stars: ✭ 25 (+66.67%)
Mutual labels:  compress
minformat
gominfmt makes the Go code more compact to aid further compression; revert with gofmt
Stars: ✭ 19 (+26.67%)
Mutual labels:  uglify
node-mollify
middleware for minify
Stars: ✭ 17 (+13.33%)
Mutual labels:  minify
express-minify
Automatically minify and cache your javascript and css files.
Stars: ✭ 85 (+466.67%)
Mutual labels:  minify
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 (+260%)
Mutual labels:  minify
Javascript Obfuscator
A powerful obfuscator for JavaScript and Node.js
Stars: ✭ 8,204 (+54593.33%)
Mutual labels:  uglify
flask minify
A Flask extension to minify request's response for html, js, css and less.
Stars: ✭ 59 (+293.33%)
Mutual labels:  minify
React-Js-Todo-App-with-firebase-auth
TodoApp using ReactJS and Firebase | ReactJS, Material UI, Firebase, ExpressJS
Stars: ✭ 88 (+486.67%)
Mutual labels:  minify

middlewares/minifier

Latest Version on Packagist Software License Testing Total Downloads

Middleware to minify the Html, CSS and Javascript content using wyrihaximus/compress and the following compressors by default:

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/minifier.

composer require middlewares/minifier

Example

Dispatcher::run([
    Middlewares\Minifier::html(),
    Middlewares\Minifier::css(),
    Middlewares\Minifier::js(),
]);

Usage

This middleware minify the code of http responses using any compressor implementing the WyriHaximus\Compress\CompressorInterface. The code format is detected from the Content-Type header, so make sure your responses contains this header (you may want to use middlewares/negotiation for that).

use WyriHaximus\HtmlCompress\Factory;

$compressor = Factory::construct();
$mimeType = 'text/html';

$minifier = new Middlewares\Minifier($compressor, $mimeType);

Optionally, you can provide a Psr\Http\Message\StreamFactoryInterface as third argument to create the response body. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.

$streamFactory = new MyOwnStreamFactory();

$minifier = new Middlewares\Minifier($compressor, $mimeType, $streamFactory);

Helpers

Three static functions are provided to create instances of this middleware with common configuration for html, css and js responses:

$htmlMinifier = Middlewares\Minifier::html();
$cssMinifier = Middlewares\Minifier::css();
$jsMinifier = Middlewares\Minifier::js();

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

The MIT License (MIT). Please see LICENSE for more information.

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].