-
21 Feb 2013 6:25 PM #1
Include extra scripts in Ext JS build
Include extra scripts in Ext JS build
Hi
I'm trying to use Sencha Cmd to build an Ext JS 4.1.1a application that uses a third party script (non-Ext) which I have included in the index.html - all works well in this dev environment.
However, when I try to build with Sencha Cmd 3.0.2.288 I need a way to include these extra scripts in the process so they are copied to the output directory.
In a Sencha Touch app you would include these in the app.json file but I'm not sure what the equivalent is for Ext JS?
The "built" index.html includes the references to the files but they are not copied over.
Any pointers would be appreciated!
Cheers
StuartSwarmOnline.com - Web & Mobile Development and Training Services
Check out our Ext JS 4 Cookbook
...and the FREE e-book Ext JS 4 Cookbook - Exploring Further filled with recipes that we couldn't fit in!
@StuartAshworth9
@SwarmOnline
-
24 Feb 2013 5:52 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
This is simple to do; all that's needed is to choose the appropriate target in build.xml. For this example, we'll hook into the -after-page build target to minify the 3rd-party script. Place the following into your project root node in build.xml:
Note that it's also possible to define the common.dir property in the ./.sencha/app/sencha.cfg file:Code:<property name="common.dir" location="common"/> <target name="-after-page"> <x-sencha-command> fs minify --from=${common.dir}/in.js --to=${common.dir}/out.js --compressor=closurecompiler </x-sencha-command> </target>
And here we'll combine the two operations into one:Code:app.name=MyApp app.framework=ext app.classpath=${app.dir}/app common.dir=common app.cmd.version=3.0.2.288
Code:<target name="-after-page"> <x-sencha-command> fs minify --from=${common.dir}/in.js --to=${common.dir}/out.js --compressor=closurecompiler and concatenate --from=${build.dir}/all-classes.js,${common.dir}/out.js --to=${build.dir}/final-build.js </x-sencha-command> </target>Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
25 Feb 2013 9:21 AM #3
Is there any way to overwrite or delete a previously concatenated file just before the "fs concatenate" command is executed? An additional argument, maybe? Docs won't help.
-
25 Feb 2013 10:08 AM #4
OK, found it. We could just use ant stuff within <target name="-after-page">:
Code:<delete file="${path.to.some.file}"/>
-
25 Feb 2013 11:28 PM #5
Thanks for the reply Mitchell, that got things sorted.
Cheers
StuartSwarmOnline.com - Web & Mobile Development and Training Services
Check out our Ext JS 4 Cookbook
...and the FREE e-book Ext JS 4 Cookbook - Exploring Further filled with recipes that we couldn't fit in!
@StuartAshworth9
@SwarmOnline
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote