Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minification should be done with PHP #1

Open
florentb opened this issue Mar 23, 2015 · 1 comment
Open

Minification should be done with PHP #1

florentb opened this issue Mar 23, 2015 · 1 comment

Comments

@florentb
Copy link
Member

Just a reminder note and a discussion entry point on the minification task. What is the problem with Minify ? Minification should be done with PHP because many PAAS are "platform exclusive". The NodeJS alternative (2ef87ad) is temporarily acceptable but couldn't be part of the final release.

@jaubourg
Copy link
Member

What wrong with Minify?

  1. Performance is abysmal

    Opening an entire new process each time and feeding javascript code to UglifyJS through stdin is competitive at small sizes and always faster past the 100kb mark (the zone that interests us).
    That's just preposterous!
    What it means is that a local node server PHP would pipe javascript code into would outperform Minify all the time.

  2. Minification is just not up to par with industry standards

    Tests show that Minify is an order of magnitude less effective than UglifyJS. Ouputs of Minify are consistently double the size, never below 1.5 times the size.

  3. Minify is based on antiquated technology

    There's a reason Minify is so bad, its minification process is based on the same old PHP port of Doug Crockford's JSMin.
    Worse, as far as I can tell, this part of the code hasn't seen any change in 3 years... which brings us to...

  4. Minify is not active

    Like I said, no change in the minification code in 3 years but, overall, the latest commit dates October last year!

  5. We just need a good JavaScript minifier

    FullStack already handle SCSS compilation (output is already compact CSS) and JavaScript concatenation (it goes even further by integrating style into scripts).
    HTML minification is orthogonal to what FullStack deals with (minifying templates is overkill and we already have the normalizeSpace option on by default for those).
    So all we need is a JavaScript minifier and Minify embeds a poor excuse of one.

I created a folder to test minifiers (59c7019). For the time being, it runs UglifyJS and JSMin as found in Minify. It's easy to add minifiers to test.

I undertand the problem with PAAS only providing a single platform and I'd love to have a PHP-based minifier. However, as it stands now, a node web service close enough to the FullStack install would outperform current "state-of-the-art" PHP minifiers and divide minified file size by 2.

Keep in mind that even if using UglifyJS wasn't competitive in term of performance, since we will cache the output, minification effectiveness should still be the deciding factor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants