jeudi 12 juin 2014

Explanation of possibility to minify the code

Hello.

I was wondering on how `sencha compile` works and if it's possible to minify a webapp using this command.


I generated an application using sencha generate app command. I used this using latest 2.3.1a ST2 SDK and 5.0.0.160 Sencha command line tool.


I made some modifications in app.js and app\ directory.

What bothers me is that sencha loads round 250 js files separately. I would like to put them into one and minify using compressor.


By default app.json requires sencha-touch.js ; this app.json file is being read by microloader and later where it finds necessary js files (now it's only sencha-touch.js and app.js) and appends them to index.html file


If I use sencha-touch-all.js, however, it would not include those 250 other js files but only itself plus my app\ folder.


What I would like to achieve is: put all files from app\ directory, sencha-touch-(noall!).js and all DEPENDENCIES that my application is using (basing on Ext.require() and require: []) from all files inside the app.js and app\ directory.


In worst case it's also fine if sencha-touch-all.js is used (without detecting which classes are really necessary) but it should be compresed nonetheless.


I already tried dozens commands with sencha compile concanete/page with -sdk -classpaths' etc but I completly don't know how to use it and documentation doesn't give useful examples on that.


What I'm ending up with usually is 4MB js file which if I include I receive error that Ext.Loader could not be loaded or I end up with all-classes.js which is empty (0K and output.html which is exactly the same as index.html


Thank you





Aucun commentaire:

Enregistrer un commentaire