Stolz / Assets

An ultra-simple-to-use assets management library for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please add JsMinPlus support

vladrusu opened this issue · comments

Hello!
Currently, your plugin uses JSMin to minify JS files in the pipeline. Please add an option to choose JSMinPlus instead (via an option in config.php).

Currently, I have to change this line every time your plugin updates (in Manager.php)

return \JSMin::minify($buffer);
->
return \JSMinPlus::minify($buffer);

commented

May I ask what are the advantages of JSMinPlus vs. JSMin?. Last time I checked JSMinPlus was ~6 times slower than JSMin but only ~0.01 times better in size. I want to know before implementing the requested feature and taking the risk of getting an horde of users ranting about getting time out when using the new config option.

Meanwhile... why don't you use something like this in your ' composer.json`

...
"scripts": {
    "post-update-cmd": [
        "sed -i "s/JSMin::minify/JSMinPlus::minify/" vendor/stolz/assets/src/Stolz/Assets/Manager.php"
    ],
...

Thank you for your detailed answer.
The "sed" trick did it for me. 👍

I used JSMinPlus for my last project because it strips all the comments (including /*! important comments */). JSMin preserves important comments. My client wanted that ALL comments to be stripped off from the minified js.... so that's why I used JSMinPlus.

commented

Glad to help. Thanks for using the library.