watrboy00
27 Mar 2009, 11:56 PM
So today while I was at work I got to thinking that its a takes a lot of effort to run all these separate JS Builder projects just to generate a complete Ext JS build with the required JavaScript and accompanying resources as well as a build of my website's JavaScript and accompanying resources.
Now I know what you are all thinking....wow you must be lazy a whole whopping 2 clicks per jsb project?!?! Well I am a programmer and I am very lazy! :D
So in my nature to be completely lazy as possible I decided to tackle this and add a new attribute for the jsb source.
Attribute: 'output'
Example:
<file name="YOUR SOURCE FILE" output="true" path="YOUR OUTPUT PATH RELATIVE TO THE BUILD SETTINGS OUTPUT DIRECTORY" />
I add this attribute in because the 'Copy source to the following directory' build settings didn't quite work the way I wanted it to. Obviously I use JS Builder to minify my css and js source to move it to a production enviorment but it would be nice to only copy the needed files over to the output directory instead of all them (IE all the images used in the css but not the source css or js). Remember we are combinding compressing multiple files down to just one. I don't need all the files that were used in building the minified file...just the end result.
Having this new attribute allows you to output images to the output directory just like a target would but without having to specify a build target. Now instead of having a JSB for CSS, Images, and JavaScript you can have just on JSB that does it all.
So now in my production environment I have the following directory sturcture pre-build...
.
..css
..images
..resources
..scripts
in which case my jsb project takes the files from the css, images, and scripts folders and outputs them to the resources folder. On post build I just do a delete command of the css, images, and scripts folders and I am left with the resources folder only containing just the minified css & js as well as the required images for them. No cleanup of unneeded files on the server when I am all done.
I've attached two zip files...one a setup file for the new exe of JS Builder and a sample JSB project showing usage. Just drop an ext js source in a folder named 'ext' and place the sample jsb in the same root folder as the ext and build on.
I can post the solution as well if anyone would like.
Enjoy!
Now I know what you are all thinking....wow you must be lazy a whole whopping 2 clicks per jsb project?!?! Well I am a programmer and I am very lazy! :D
So in my nature to be completely lazy as possible I decided to tackle this and add a new attribute for the jsb source.
Attribute: 'output'
Example:
<file name="YOUR SOURCE FILE" output="true" path="YOUR OUTPUT PATH RELATIVE TO THE BUILD SETTINGS OUTPUT DIRECTORY" />
I add this attribute in because the 'Copy source to the following directory' build settings didn't quite work the way I wanted it to. Obviously I use JS Builder to minify my css and js source to move it to a production enviorment but it would be nice to only copy the needed files over to the output directory instead of all them (IE all the images used in the css but not the source css or js). Remember we are combinding compressing multiple files down to just one. I don't need all the files that were used in building the minified file...just the end result.
Having this new attribute allows you to output images to the output directory just like a target would but without having to specify a build target. Now instead of having a JSB for CSS, Images, and JavaScript you can have just on JSB that does it all.
So now in my production environment I have the following directory sturcture pre-build...
.
..css
..images
..resources
..scripts
in which case my jsb project takes the files from the css, images, and scripts folders and outputs them to the resources folder. On post build I just do a delete command of the css, images, and scripts folders and I am left with the resources folder only containing just the minified css & js as well as the required images for them. No cleanup of unneeded files on the server when I am all done.
I've attached two zip files...one a setup file for the new exe of JS Builder and a sample JSB project showing usage. Just drop an ext js source in a folder named 'ext' and place the sample jsb in the same root folder as the ext and build on.
I can post the solution as well if anyone would like.
Enjoy!