PDA

View Full Version : YUI Compressor seems useless for ExtJS app minification.



xjscrafter
10 Feb 2014, 7:11 PM
My manager wants me to look into initially using YUI Compressor to minify our ExtJS 4.2 app.

So I wrote a python file to concatenate all my ExtJS app files into a single file, and then minify that one file with YUI Compressor.

But I get errors related to objects not found, because order matters with JavaScript.

So for an app with many files, with multiple developers adding new files, it seems questionable whether YUI Compressor can be effectively used to minify ExtJS apps.

Is this true, or am I missing something?

burnnat
11 Feb 2014, 5:50 AM
You're not missing anything; it would be hard (though not impossible) to use YUI Compressor with ExtJS directly, for precisely the reasons you mention.

Have you considered using Sencha Cmd (http://www.sencha.com/products/sencha-cmd/download) instead? It uses YUI Compressor internally to perform the minification, but it adds extra logic to determine the proper dependency order for your javascript files (and has a host of other features as well for theming, packaging, and workspace management).

xjscrafter
11 Feb 2014, 7:04 AM
I would love to use Sencha Cmd. But these two things might prevent me from doing so:

1) I think Sencha Cmd needs to be installed manually, at least on Windows machines. This reduces our flexibility of allowing everyone to easily pull from git and build entire app.

2) Sencha Cmd is not compressing all the files in my app, in fact, almost none:
http://www.sencha.com/forum/showthread.php?281191-Why-is-Sencha-Cmd-not-adding-most-of-my-ExtJS-4.2-app-into-app.js.&p=1028280#post1028280

xjscrafter
11 Feb 2014, 10:36 AM
anyone