PDA

View Full Version : Including additional js files in jsb3



dogomatic
6 Feb 2012, 12:32 AM
Is there a way to include extra files in the jsb3 created by sencha create?

I've got a couple of files that I don't load with Ext.Loader (Because they aren't classes) so they are not added to the jsb3 file. Right now, every time I regenerate the jsb3 file I have to re-add the extra files to the jsb3.

I tried using Ext.require('myfile.js') instead of <script> tags but that fails because they aren't classes.

Here's what I've got:


<script type="text/javascript">
Ext.Loader.setConfig({
enabled: true,
paths: {
"Ext": "${url('/media/extjs/src')}",
"Ext.ux": "${url('/media/extjs/ux')}",
"MyApp": "${url('/app')}"
},
disableCaching: false
});
</script>
<script type="text/javascript" src="${h.auto_ver('/app/vtypes.js')}"></script>
etc...


vtypes.js isn't a class, it adds some extra vtypes to Ext.form.VTypes using Ext.apply.

mitchellsimoens
6 Feb 2012, 8:14 AM
You can edit the jsb3 file after it was created.

dogomatic
6 Feb 2012, 3:30 PM
Hey Mitchell thanks for replying, that's what I'm doing right now.

I think I'm just going to load the jsb3 json in a python script, add the extra files and write it back.

edit: On 2nd thought, that may be what you're suggesting.

ratmat2000
8 Feb 2012, 5:51 PM
It would be really nice if the 'sencha create' command ad the option to include all JS files found in <script> tags in the html file it is parsing. Having to edit the JB3 file is a pain.