wikimedia/minify

Minification of JavaScript code and CSS stylesheets.

2.2.4 2021-07-28 00:27 UTC

This package is auto-updated.

Last update: 2021-07-29 18:41:44 UTC


README

Minify is a PHP library for minification of JavaScript code and CSS stylesheets.

Quick start

Install using Composer, from Packagist.org:

composer require wikimedia/minify

Usage

use Wikimedia\Minify\JavaScriptMinifier;

$input = '
/**
 * @param a
 * @param b
 */
function sum(a, b) {
	// Add it up!
	return a + b;
}
';

$output = JavaScriptMinifier::minify( $input );
// Result:
// function sum(a,b){return a+b;}
use Wikimedia\Minify\CSSMin;

$input = '
.foo,
.bar {
	/* comment */
	prop: value;
}
';

$output = CSSMin::minify( $input );
// Result:
// .foo,.bar{prop:value}

Contribute

See also