forked from tchwork/jsqueeze
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4cc529e
commit d622a39
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
JSqueeze: Efficient JavaScript minification in PHP | ||
================================================== | ||
|
||
JSqueeze shrinks / compresses / minifies / mangles Javascript code. | ||
|
||
It's a single PHP class licensed under Apache 2 and GPLv2 that is beeing | ||
developed, maintained and thouroughly tested since 2003 on major JavaScript | ||
frameworks (e.g. jQuery). | ||
|
||
JSqueeze operates on any parse error free JavaScript code, even when semi-colons | ||
are missing. | ||
|
||
In term of compression ratio, it compares to YUI Compressor and UglifyJS. | ||
|
||
Features | ||
-------- | ||
|
||
* Removes comments and white spaces. | ||
* Renames every local vars, typically to a single character. | ||
* Keep Microsoft's conditional comments. | ||
* In order to maximise later HTTP compression (deflate, gzip), new variables | ||
names are choosen by considering closures, variables' frequency and | ||
characters' frequency. | ||
* Renames also global vars, methods and properties, but only if they are marked | ||
special by some naming convention. By default, special var names begin with | ||
one or more "$", or with a single "_". | ||
* Renames also local/global vars found in strings, but only if they are marked | ||
special. | ||
* If you use with/eval then be careful. | ||
|
||
Bonus | ||
----- | ||
|
||
* Replaces false/true by !1/!0 | ||
* Replaces new Array/Object by []/{} | ||
* Merges consecutive "var" declarations with commas | ||
* Merges consecutive concatened strings | ||
* Fix a bug in Safari's parser (http://forums.asp.net/thread/1585609.aspx) | ||
* Can replace optional semi-colons by line feeds, thus facilitating output | ||
debugging. | ||
* Keep important comments marked with /*!... | ||
* Treats three semi-colons ;;; like single-line comments | ||
(http://dean.edwards.name/packer/2/usage/#triple-semi-colon). | ||
* Fix special catch scope across browsers | ||
* Work around buggy-handling of named function expressions in IE<=8 | ||
|
||
To do? | ||
------ | ||
|
||
* foo['bar'] => foo.bar | ||
* {'foo':'bar'} => {foo:'bar'} | ||
* Dead code removal (never used function) | ||
* Munge primitives: var WINDOW=window, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "patchwork/jsqueeze", | ||
"type": "library", | ||
"description": "Efficient JavaScript minification in PHP", | ||
"keywords": ["javascript","compression","minification"], | ||
"homepage": "https://github.com/nicolas-grekas/JSqueeze", | ||
"license": "(Apache-2.0 or GPL-2.0)", | ||
"authors": [ | ||
{ | ||
"name": "Nicolas Grekas", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.1.4" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"JSqueeze": "class/" | ||
} | ||
} | ||
} |