PDA

View Full Version : Include only required classes in ext-all.js



zzhouag
12 Aug 2013, 7:58 PM
Hi, I want to reduce the size of ext-all.js.
Refer to some posts, I think the proper way is to generate a jsb file of my project and build an app-all.js only include required classes, then use ext.js instead of ext-all.js.

My project architecture as below



app
--module1
--controller
--model
--store
--view
--module2
--controller
--model
--store
--view
......
extjs-4.2
app.js
main.html
......

Is that possible to achieve that under sencha cmd 3.1.2? Are there some examples? Thank you!

scottmartin
13 Aug 2013, 6:08 AM
Sencha Cmd does this automatically ... it reads your classes and then creates and all-classes.js that includes the required classes for your app, as well as your app.

You can always use the 'sencha compile' aspect of Cmd to create custom versions. This is low level and usually not required.

If you are moving from JSB (tools) to Cmd .. you will need to generate a new app with your namespace and the move your existing files over to the new;y generated app, as there is metadata that is created for Cmd. You would need to then run 'sencha refresh' after you have moved your app files over to update your meta with the app classes.

If you run sencha app generate and sencha app build, that will create you a full working example.



sencha -sdk /path/to/sdk generate app MyApp /path/to/myapp
sencha app build


Scott.

zzhouag
13 Aug 2013, 7:53 AM
Hi scottmartion, thank you for your reply, it's what I looking for. But when I generate my app, the following errors occur...

......
[INF] [x-property-file] Updating property file: /Volumes/zzgHD/ASTRI/HEMS/hems/fe/web/.sencha/app/sencha.cfg
[ERR]
[ERR] BUILD FAILED
[ERR] java.lang.NullPointerException
[ERR]
[ERR] Total time: 1 second
[ERR] com.sencha.exceptions.BasicException
[ERR] com.sencha.exceptions.BasicException

scottmartin
13 Aug 2013, 8:20 AM
Can you post your generate command?

What if you generate to a local path? Is your path a LAN drive?

Scott.

zzhouag
13 Aug 2013, 9:25 AM
My path is my local drive, the commands as below:

ZZGs-MacBook-Pro:/ ZZG$ cd /Volumes/zzgHD/ASTRI/HEMS/hems/fe/extjs-4.1.3
ZZGs-MacBook-Pro:extjs-4.1.3 ZZG$ sencha generate app HEMS /Volumes/zzgHD/ASTRI/HEMS/hems/fe/web

scottmartin
13 Aug 2013, 9:42 AM
See if you get a better result with specifying the SDK



sencha -sdk /Volumes/zzgHD/ASTRI/HEMS/hems/fe/extjs-4.1.3 generate app HEMS /Volumes/zzgHD/ASTRI/HEMS/hems/fe/web


Scott

zzhouag
13 Aug 2013, 7:31 PM
Hi Scott, I tried, but still the same error. And I found this post looks the same problem but no answer yet

http://www.sencha.com/forum/showthread.php?266930-cmd-v3.1.2.342-BUILD-FAILED-java.lang.NullPointerException

Thank you

scottmartin
13 Aug 2013, 7:48 PM
Perhaps try uninstalling and reinstall everything from scratch (Sencha Cmd) .. did you upgrade from a previous version?

What versions of Ruby, Compass, Java do you have installed?



Scotts-MacBook-Pro:~ scottmartin$ sencha -sdk /Users/scottmartin/Sites/extjs413 generate app Test /Users/scottmartin/Sites/test413 > gen.log
Scotts-MacBook-Pro:~ scottmartin$ cat gen.log
Sencha Cmd v3.1.2.342
[INF]
[INF] init-plugin:
[INF]
[INF] -before-generate-workspace:
[INF]
[INF] cmd-root-plugin.init-properties:
[INF]
[INF] init-properties:
[INF]
[INF] init-sencha-command:
[INF]
[INF] init:
[INF]
[INF] generate-workspace-impl:
[INF] [echo] generating into /Users/scottmartin/Sites/test413 from /Users/scottmartin/Sencha/Cmd/3.1.2.342/templates/workspace
[INF] [mkdir] Created dir: /Users/scottmartin/Sites/test413/packages
[INF]
[INF] cmd-root-plugin.copy-framework-to-workspace-impl:
[INF] [propertyfile] Updating property file: /Users/scottmartin/Sites/test413/.sencha/workspace/sencha.cfg
[INF]
[INF] copy-framework-to-workspace-impl:
[INF] [copy] Copying 1925 files to /Users/scottmartin/Sites/test413/ext
[INF] [copy] Copying 86 files to /Users/scottmartin/Sites/test413/ext/src/ux
[INF] [propertyfile] Updating property file: /Users/scottmartin/Sites/test413/.sencha/workspace/sencha.cfg
[INF]
[INF] copy-framework-to-workspace:
[INF]
[INF] generate-workspace:
[INF]
[INF] -after-generate-workspace:
[INF]
[INF] init-plugin:
[INF]
[INF] cmd-root-plugin.init-properties:
[INF]
[INF] init-properties:
[INF]
[INF] init-sencha-command:
[INF]
[INF] init:
[INF]
[INF] before-upgrade:
[INF]
[INF] generate-app-impl:
[INF]
[INF] generate-starter-app:
[INF] [x-property-file] Updating property file: /Users/scottmartin/Sites/test413/.sencha/app/sencha.cfg
[INF]
[INF] init-plugin:
[INF]
[INF] cmd-root-plugin.init-properties:
[INF]
[INF] init-properties:
[INF]
[INF] init-sencha-command:
[INF]
[INF] init:
[INF]
[INF] app-refresh-impl:
[INF] Loading classpath entry /Users/scottmartin/Sites/test413/ext/src
[INF] Loading classpath entry /Users/scottmartin/Sites/test413/app
[INF] Loading classpath entry /Users/scottmartin/Sites/test413/app.js
[INF] Appending concatenated output to file /Users/scottmartin/Sites/test413/bootstrap.js
[INF] Appending concatenated output to file /Users/scottmartin/Sites/test413/bootstrap.js
[INF] Appending concatenated output to file /Users/scottmartin/Sites/test413/bootstrap.js
[INF]
[INF] app-refresh:
[INF]
[INF] after-upgrade:
[INF]
[INF] generate-app:
[INF]
[INF] -after-generate-app:
[INF] [x-property-file] Updating property file: /Users/scottmartin/Sites/test413/.sencha/app/sencha.cfg


Scott

zzhouag
13 Aug 2013, 9:07 PM
Hi Scott, problem solved after uninstall and reinstall everything! Maybe I made some mistake when I was doing upgrade from the previous version. Thank you very much! :)