ametaireau/pelican — pull request #337 by saimn (2012-05-07 15:32:52+00:00)
Title: Assets management with webassets

This PR is a proposition for integrating webassets (http://webassets.readthedocs.org/en/latest/index.html) to concatenate, minify or compile css and js.

Currently I concatenate and minify my css files with a fabric rule but I think that it would be great to have this directly in pelican, and webassets seems to be a great tool to do that: it is very flexible, allowing to use your favorite tools for both js and css : http://webassets.readthedocs.org/en/latest/builtin_filters.html

There are 2 ways to use webassets. The first would be to define the bundles in the python code taking values from pelican's config file or from a yaml file (in the theme maybe). The second that I implemented is simply to define the environnement for webasset (the path and url of static files) and let the theme define the relevant assets. For example:

```html
{% assets filters="cssmin", output="css/style.min.css", "css/inuit.css", "css/pygment-monokai.css", "css/main.css" %}

{% endassets %}
```

will produce:

```html

```

You can notice the `b3a7c807` version identifier which is another feature of webasset for cache management.
If you are interested in, I must probably find a cleaner way to handle generators in `__init__.py` ;-)