To get automated javascript \and css files into your war files during the netbeans build process do the following :-
- Download the YUI Compression Lib making sure you abide by the terms of the licence agreement.
- Download the YUIAnt.jar , this is the ant task required, see this page for information.
For web applications that you want to build with compressed js/css files add the folloing xml to the build.xml for the project, overiding the "-pre-dist" ant target which is not currently configured by default in netbeans.
This will compress and copy the js and css files to the build directory before the war file is built and will thus be included in your war file.
<target name="-pre-dist">
<echo level="info" message="Compressing JavaScript and CSS files...." />
<path id="yuicompressor.classpath">
<fileset dir="${ant.home}/lib">
<include name="yuicompressor-2.3.5.jar"/>
</fileset>
</path>
<taskdef name="yuicompress"
classname="com.yahoo.platform.yui.compressor.YUICompressTask">
<classpath>
<path refid="yuicompressor.classpath"/>
</classpath>
</taskdef>
<yuicompress linebreak="300" warn="false" munge="no"
preserveallsemicolons="true"
outputfolder="${basedir}/${build.web.dir}" >
<fileset dir="${basedir}/web"
excludes="/ext-2.1/**/*.js" >
<include name="**/*.js" />
<include name="**/*.css" />
</fileset>
</yuicompress>
<echo level="info" message="Compression Complete" />
</target>
Note there is a line in my example with an "exclude" for my ext-2.1 directory, the files there are already compressed so i have excluded them, just add/remove to suit your application.
The payload without compression on my current project is 880kb after compression 620kb, and has shaved a couple of seconds off the browser load time too.
All we need now is for someone to code a netbeans plugin that configures this all for us and makes it configurable from a wizard maybe, any takers ?
I have also stumbled upon this excellent nb6.1 plug-in for pl/sql editing be sure to check it out if you want to edit pl/sql from within netbeans.
Happy coding....