This article is fairly old and probably contains information that is no longer relevant. Read with care!
This article may be too advanced for beginner programmers. Unfortunately, I will not support any code that I do not write (in this case), so if you have troubles installing some of the packages required below, please see the authors of the problem code. Thank you.
Here’s what you’ll be responsible for:
- Download both CSSTidy and the PHP port of Packer using the links above.
- Download Phing if you don’t already have it, and install it. Note the following change I had to make to my Phing binphing.bat file to get it working: Change
set PHP_CLASSPATH="%PHING_HOME%classes"to remove the quotes:
- Download the two Filters I made for Phing: JSPackerFilter.phps and CssTidyFilter.phps, change the extensions to .php and copy into your phing directory
Change the path in the include_once declaration at the top of each of the files to point to the csstidy and packer libraries you downloaded above:
Get a working build file set up to point the directories your project is using. Here is a sample I made:
Templates for CssTidy include:
high_compression(declarations are limited to one line apiece),
highest_compression(everything is put on one line).
The above build file is set up to work with the following directory structure:
Files are copied from the source in /Web to the /Build/Web directory. I hope that you can see from the build.xml file above that the target directory is specified in the copy tag, todir attribute.
<copy todir="./Web/js" overwrite="true">
and the source directory is specified in the fileset tag, dir attribute.
<fileset dir="../Web/css"> <include name="*.css" /> </fileset>
And then, all you need to do is navigate to the directory holding your build.xml and run the phing command (if you have phing in your path. If not, you can use an absolute link to phing, for example