CSS and Javascript Minifier

Minify and combine CSS stylesheets (using @imports) or Javascripts (using a proxy JSON script) into a single sheet or script.

Advanced options

Minifier 0.6 (cssutils 0.9.10b1) API

If you do not want to use this simple frontend you also may use the Minifier as a simple webservice (big word...).

Request

CSS

Any @import in the given CSS stylesheet is resolved and results in a single stylesheet. Simply send the URL of the CSS to be combined and minified to: http://minifier.appspot.com/cssmin?url=

Javascript

As Javascript in contrast to CSS has no built in import facility a simple JSON proxy script which lists the to be imported scripts is used. Please mind the exact JSON syntax (no comments, only double quotes etc.). Example: { "imports": ["1.js", "2.js"] } The list contains relative (to the proxy) paths of the scripts to be combined and minified.

Send the URL of a JSON proxy script to be combined and minified to: http://minifier.appspot.com/jsmin?url=

Parameters

url (mandatory)
Absolute URL of CSS or Javascript to minify.
errorlevel = INFO | WARNING [default] | ERROR | FATAL
(CSS only) Normally only valid stylesheets will be minified, for all other a 400 BAD REQUEST with information about parsing problems will be given. When setting errorlevel messages below will be ignored.
flat = true [default] | false
(CSS only) If given @import rules will be resolved. If the referenced sheet cannot be read the rule will be kept as is.
vars = true [default] | false
(CSS only) If given @variables rules will be removed and any var() values are resolved.
encoding
(CSS only) Target encoding of resulting minified CSS. Currently only UTF-8 and ASCII (being an UTF-8 subset) do work.

Example

http://minifier.appspot.com/cssmin?url=http://minifier.appspot.com/static/css.css
http://minifier.appspot.com/jsmin?url=http://minifier.appspot.com/static/test/jsonproxy.js

Response

The response contains the minified CSS or script (send with UTF-8 encoding). The CSS depending on the encoding parameter might actually be serialized as ASCII so e.g. a german umlaut ä will be serialized as /E4.

In case of any error a 400 BAD REQUEST is returned and the response contains the error. This might for example be if the URL given returns no valid CSS or no CSS at all or no valid JSON or any of the references scripts are not readable. Currently the CSS must be valid!

A 500 INTERNAL SERVER ERROR might also happen.

© Copyright 2008-2012 Christof Höke | About

The CSS Minifier tries to read the CSS from given URL and minifies it. @import rules may optionally be resolved resulting in a single stylesheet.

A target encoding for the resulting stylesheet may be given but currently only UTF-8 or ASCII encoded CSS are working properly.

The Javascript minifier combines Javascripts using a custom defined proxy JSON script and uses jsmin to minify the result.