mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 18:52:42 +01:00
0569218201
Summary: If `jsxmin` is not available, use a pure PHP implementation instead (JsShrink). Test Plan: - Ran `arc lint --lintall` on all JS and fixed every relevant warning. - Forced minification on and browsed around the site using JS behaviors. Didn't hit anything problematic. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5670
23 lines
695 B
Text
23 lines
695 B
Text
JsShrink - Remove spaces and comments from JavaScript code
|
|
Available in PHP and JavaScript
|
|
Requires statements ending by semicolon, use JSHint or JSLint to verify.
|
|
|
|
http://vrana.github.com/JsShrink/
|
|
|
|
Usage PHP:
|
|
<?php
|
|
include "jsShrink.php";
|
|
echo jsShrink($code);
|
|
?>
|
|
|
|
Usage JavaScript:
|
|
<script type="text/javascript" src="jsShrink.js"></script>
|
|
<script type="text/javascript">
|
|
textarea.value = jsShrink(code);
|
|
</script>
|
|
|
|
Note:
|
|
Google Closure Compiler is much more powerful and efficient tool.
|
|
JsShrink was created for those looking for PHP or JavaScript only solution.
|
|
Most other JS minifiers are not able to process valid JavaScript code:
|
|
http://php.vrana.cz/minifikace-javascriptu.php#srovnani
|