Versatile HTML compression.
It is a Perl script to parse web pages before publishing. User-defined place-holders of macros can be expanded. Invisible comments and extra whitespace can be removed. Being Perl, it is essentially freely programmable to suite your website.
You copy the configuration file to the directory of your HTML source files and edit it. Here you define your own macros and general search and replace patterns. You also specify into which folder the result files should be saved to.
Site-specific settings can be defined through different config files in separate source folders.
Whenever an HTML file is ready for publishing you "compile" it with htmlXPress. In Mac OS X, you can do that directly from the command line in the Terminal:
% htmlXPress myfile.html
Alternatively, you can drag and drop your HTML file onto the htmlXPress icon. This is possible by using a MacPerl droplet (Mac OS 9) or DropScript (Mac OS X).
Better automation can be achieved using
For example, you may use a rule similar to this in your
HXP=/usr/local/htmlXPress/htmlXPress.pl OUT=/Library/Apache/htdocs # Use htmlXpress to process .html files: $(OUT)/%.html : %.html $(HXP) -out $(OUT) $< @chmod 644 $(OUT)/$(@F)
If you do not have Mac OS X, you will need a custom installation of Perl, such as MacPerl which has been ported to the Mac by Matthias Neeracher.
The latest version of MacPerl can be obtained at:
This neat little utility is the brainchild of Wilfredo Sánchez. It can be obtained at www.wsanchez.net.
01 April 2015
htmlXPress is programmed in Perl. A basic knowledge of Perl and regular expressions is needed.
Since version 2.2, htmlXPress can verify that all hyperlinks are still valid.
Cascading style sheets can be compressed in much the same way (For an example, look at this one).
Example: look at the source of this page (Safari: Develop > Show Page Source).
You can define flexible macros for you own needs. For instance you could us a macro such as <:font 1:> which can be expanded to something like <font size=1 face="Verdana, Arial, Helvetica, sans-serif">.
You are not limited to search and replace patterns. Using foreach loops and other commands, you can define complex code that builds up a section of your pages automatically.
Example: A loop that will create an HTML table with the data from your source file.