Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4074144
README.md
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
README.md
View Options
#
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
!
*
[
T37492
](
https
:
//phabricator.wikimedia.org/T37492): In CSS, content within quoted
strings
that
looks
like
source
code
are
sometimes
minified
.
*
[
T287631
](
https
:
//phabricator.wikimedia.org/T287631): In CSS, writing a URL
over
multiple
lines
with
escaped
line
-
breaks
is
not
supported
.
##
Contribute
*
Issue
tracker
:
<
https
:
//phabricator.wikimedia.org/tag/wikimedia-minify/>
*
Source
code
:
<
https
:
//gerrit.wikimedia.org/g/mediawiki/libs/Minify>
*
Submit
patches
via
Gerrit
:
<
https
:
//www.mediawiki.org/wiki/Developer_account>
##
See
also
*
High
-
level
documentation
:
<
https
:
//www.mediawiki.org/wiki/ResourceLoader/Architecture>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 17 2026, 14:40 (10 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2e/c1/0f4121d6d21f720309e1292fa363
Default Alt Text
README.md (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment