# minify
**Repository Path**: mirrors_wikimedia/minify
## Basic Information
- **Project Name**: minify
- **Description**: Mirror of https://gerrit.wikimedia.org/g/mediawiki/libs/Minify See https://www.mediawiki.org/wiki/Developer_account for contributing.
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-02-04
- **Last Updated**: 2026-06-27
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# wikimedia/minify
Minify is a PHP library for minification of JavaScript code and CSS stylesheets.
## Quick start
Install using [Composer](https://getcomposer.org/), from [Packagist.org](https://packagist.org/packages/wikimedia/minify):
```
composer require wikimedia/minify
```
## Usage
```php
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;}
```
```php
use Wikimedia\Minify\CSSMin;
$input = '
.foo,
.bar {
/* comment */
prop: value;
}
';
$output = CSSMin::minify( $input );
// Result:
// .foo,.bar{prop:value}
```
## Known limitations
The following trade-offs were made for improved runtime performance and code
simplicity. If they cause problems in real-world applications without trivial
workarounds, please let us know!
* In CSS, content within quoted strings that looks like source code is sometimes minified ([T37492](https://phabricator.wikimedia.org/T37492)).
* In CSS, writing a URL over multiple lines with escaped line-breaks is not supported ([T287631](https://phabricator.wikimedia.org/T287631)).
* In JS, certain multibyte spaces are not supported as whitespace in source code (including U+00A0 No Break Space NBSP, U+2028 Line Separator, and U+2029 Paragraph Separator) and may produce invalid output. Note that these and other Unicode multibyte characters are fully supported in strings, identifiers, and regexes ([change 1278715](https://gerrit.wikimedia.org/r/c/mediawiki/libs/Minify/+/1278715)).
## Contribute
* Issue tracker:
* Source code:
* Submit patches via Gerrit:
* To run tests: `composer update`, then `composer test`
## See also
* High-level documentation: