1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-13 01:24:51 +02:00

Remove JSMin+ and old, unfinished CssCompressor port

JSMin+ was a good effort but is unmaintained and has collected several
reports of impractical memory usage for a project like this.
This commit is contained in:
Steve Clay
2015-09-29 10:38:22 -04:00
parent fede83cd48
commit e2efb342a8
8 changed files with 4 additions and 2701 deletions

View File

@@ -75,16 +75,6 @@ function yuiCss($css, $options) {
$min_serveOptions['minifiers'][Minify::TYPE_CSS] = 'yuiCss';
```
## JSMin+
Minify 2.1.3 comes with Tino Zijdel's [JSMin+](http://crisp.tweakblogs.net/blog/1665/a-new-javascript-minifier-jsmin+.html) 1.1. This is a full parser based on a port of [Narcissus](http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine)). To try it out:
```php
$min_serveOptions['minifiers'][Minify::TYPE_JS] = array('JSMinPlus', 'minify');
```
This should yield smaller javascript files, but I've tested this only briefly. For production you may want to get the [latest version](http://crisp.tweakblogs.net/blog/cat/716) (you must rename it: `min/lib/JSMinPlus.php`).
Note: JSMin+ is memory intensive, so be prepared to up your memory limit. Also it does not preserve comments that begin with `/*!` like JSMin does.
## Legacy CSS compressor
In 3.x, Minify uses [CSSmin](https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port), a PHP port of the YUI CSS compressor. To use the compressor that came with Minify 2.x (not recommended), uncomment this line in your `config.php` file:

View File

@@ -35,14 +35,14 @@ To change minifier, set `minifier` to a [callback](http://php.net/manual/en/lang
```php
$src1 = new Minify_Source(array(
'filepath' => '//js/file1.js',
'minifier' => ['JSMinPlus', 'minify'],
'minifier' => 'myJsMinifier',
));
$src2 = new Minify_Source(array(
'filepath' => '//js/file2.js',
'minifier' => '', // don't compress
));
```
In the above, `JSMinPlus.php` is only loaded when the contents of `$src1` is needed.
In the above, `JmyJsMinifier()` is only called when the contents of `$src1` is needed.
**`*`Do _not_ use `create_function()` or anonymous functions for the minifier.** The internal names of these function tend to vary, causing endless cache misses, killing performance and filling cache storage up.