-
Notifications
You must be signed in to change notification settings - Fork 0
Build Script Wizard
This tool was created to walk you through using the build script.
First things first...
You've got all your dependencies pre-installed, likely. You may need a yum install ant-contrib
or what have you.
- Get the Java JDK (JRE isn't enough)
- Get WinAnt and point the installer to
Program Files/Java/jre6/bin/
- 1) Mac users, open the application "Terminal". Windows users, open command line interface by doing Start Menu > Run >
cmd.exe
. However, Windows users, we created a friendlyrunbuildscript.bat
file for you if you'd like to avoid the command line and navigate to the build directory within your project.
For those of you new to terminal or command line, use the change directory command followed by the directory path. for example...
cd sites/your-site/build/
Note: To ensure you've navigated to the correct directory, you may want to now check the files within the current directory. Mac users can type "ls" in terminal. Windows users should type "dir" in command line. If the file list returned is what you were expecting, move to step 2. Otherwise, check the directory location in Finder or Windows Explorer and start over.
- 2) Next, simply type:
ant build
The H5BP build script will begin to run and compress your files. At the very end you should see "BUILD SUCCESSFUL" followed by the total time it took to build.
- 3) Now, look in your H5BP project folder and see that there is a newly created "publish" directory within your project. Inside, you will find your minified CSS, JS and along with duplicates of the files from your original directory. This new set of files within "publish" is your production code. The site should look and function the same in browser as it did before, but only now faster!
Note: If your new pages do not render in browser the same as they did before your ran the build script, click here (see Troubleshooting at the bottom).
There are a few different build options:
ant build # minor html optimizations (extra quotes removed). inline script/style minified (default)
ant buildkit # all html whitespace retained. inline script/style minified
ant basics # same as build minus the basic html minfication
ant minify # same as build plus full html minification
ant text # same as build but without image (png/jpg) optimizing
Check out Jay George's wordpress screencast videos: http://www.jaygeorge.co.uk/1-html5-buildscript-wordpress-1/
Using the build script on a Wordpress theme introduces a significant problem: Wordpress themes are installed to a website's /wp-content/themes/<theme-name>
directory while the build script's output references the minified/concatenated files in a relative URI as js/scripts-xxxx.min.js
. Therefore, output of the build script will reference files in the wrong location.
To make the build script output files that reference the correct url /wp-content/themes/<theme-name>/js/scripts-xxxx.js
, the build.xml file must be modified. Edit the 2 regular expressions near lines 599 (for js) and 699 (for css) to include the Wordpress PHP that dynamically references the theme's folder: (the line to add is indented)
<replaceregexp match="<!-- scripts concatenated [\d\w\s\W]*?!--
end ((scripts)|(concatenated and minified scripts))-->"
replace="<script src='
<?php bloginfo('template_url'); ?>/
${dir.js}/scripts-${build.number}.min.js\'></script>" flags="m">
That's all.
There's nothing here.
There's nothing here.
// show first panel
$("#panel-1").fadeIn();
// navigation
$(".nav").click(function(){
var href = $(this).attr("href");
$(this).parents("section").fadeOut(function(){
$(href).fadeIn();
});
});
}); </script>