View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Mark Norman Francis > CSS-Prepare-v0.9.2.4 > cssprepare


Annotate this POD


New  1
Open  0
View/Report Bugs


cssprepare - pre-process CSS style sheet(s)


cssprepare [-afhoqwx] [-b dir] [-d dir] [-l path] [-s secs] [-t secs] style sheet [...]

cssprepare [--long-options ...] style sheet [...]


cssprepare concatenates and minifies multiple cascading style sheets into one, optionally adding new features to the CSS syntax and optimising the result to save as much space as possible.


-a, --use-all-shasum

When automatically creating the output style sheet (-d, --output-dir), use the entire SHA1 checksum as the filename rather than truncating it to five characters.

-b dir, --hierarchy-base=dir

Use dir as the hierarchy base. See "Using hierarchical CSS" for more details.

-d dir, --output-dir=dir

Automatically create a file in dir with the CSS output. This filename will be based upon the first five characters of the SHA1 checksum of the content. This means repeated runs of cssprepare on the same files will only generate one output file, which is useful when using cssprepare as part of a deployment script. See "Deploying CSS" for more details.

-e, --extended-syntax

Turn on the extra features that cssprepare uses when parsing CSS. See "Extending the CSS syntax" for details.

-h, --disable-hacks

Turn off support for the "star" and "underscore" CSS hacks, and the "zoom" and "filter" properties (the most common of the work-arounds needed to deal with earlier version of Internet Explorer). See "Supported CSS hacks" for more details.

-l dir, --location=dir

Set the hierarchy location to dir. See "Using hierarchical CSS" for more details.

-o, --optimise

Attempt to optimise the structure of the CSS before outputting it. Warning: this can break your CSS. See "Optimising CSS" for a longer explanation as to why.


Create the output file file as a named pipe; then enter an infinite loop. This allows you to use cssprepare as a development environment, changing source files and seeing that change immediately reflected next time you read from the named pipe file.


In conjunction with the --server option, specify on which port the server should listen. Default is to listen on 5000.

-q, --quiet

Silence the status updates sent to STDERR during processing.


Runs a local web server (using Plack) to deliver the output of the combined style sheets, rather than saving it to a file. This allows you to develop your styles within the context of a web page, and see changes reflected immediately. Set the style sheet link to point to localhost, like so:

    <link rel="stylesheet" href="http://localhost:5000/">

You can change the port from 5000 with --port.

-s seconds, --suboptimal-threshold=seconds

Set the length of time that can pass before cssprepare switches optimisation to a faster (but less efficient) method. Note: this applies to each style sheet, not to the length of time cssprepare will run.

-t seconds, --timeout=seconds

Set the length of time that can pass before any HTTP requests will fail when the remote server does not respond.

-w, --warnings-only

Only output warnings and errors found in the processed style sheet(s), and set the return value of cssprepare to the number of errors. This is useful for CSS validation.

-x, --exit-on-error

Exit before producing any output if there were any errors. This is useful for prematurely exiting from automatic build scripts, rather than generating incorrect output.


The only fixed requirement CSS::Prepare has is that the version of the perl interpreter must be at least 5.10.

If you wish to use @import url(...); in your style sheets you will need one of HTTP::Lite or LWP::UserAgent installed.

Some parts of the extended CSS syntax are implemented as optional plugins. For these to work you will need Module::Pluggable installed.



Mark Norman Francis,


Copyright 2010 Mark Norman Francis.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: