Skip to content

cssmerge 1.15 released

Apologies for the download link being broken for a while. For some reason, anything with a .pl suffix doesn’t work at my new hosting provider. Fixed now.

A new version of cssmerge is available. Download, rename it to cssmerge, and run with perl cssmerge (or make it executable and put it somewhere in your PATH).

There are several major changes since the last release.

First of all, it has been rewritten to use CSS::Tiny instead of the rather heavyweight and buggy CSS. So please ensure you have CSS::Tiny installed.

A new option --regex allows you to search for selectors or properties using Perl regular expression syntax.

Meanwhile the mechanism used by the default search method (when neither --regex nor --exact is specified) is now more precisely specified. It differs according to whether you’re searching for selectors or properties, so that most of the time it should just Do The Right Thing.

For example, cssmerge --selector a will return all codeblocks relating to the element <a> (including li ul a.foo, a:hover etc), but not the element <abbr> nor any class .a or ID #a. To search for classes, ID or pseudos, simply include the appropriate sigil in your search, ie --selector .class, --selector '#id', --selector :hover. Note the quotes in the second example there; some shells will otherwise ignore anything following a hash sign.

cssmerge --property font will search not just for the font property but also font-family, font-size etc… which is almost certainly what you want. If it isn’t, of course, you can use --exact or --regex 🙂

There is also support for escaped characters in identifiers, per the CSS 2.1 spec.

Your feedback is always welcome. Please feel free to add a comment to this post, or send email to the address on the About page.