LESS stylesheets

We now have LESS integrated into the deploy packaging process. Here's how it works:

In development mode, the less compiler is included in the javascript shared-package. This lets you include less stylesheets with a <link rel='stylesheet/less' type='text/css'> element. Each less file in a stylesheet package will be included using this method in dev mode.

For production, all files in a package are combined into one file. Before a package's files are combined, the less compiler will be called for the less file listed in the package. It's an error to have multiple less files in one package. If you want to split up your CSS and use imports, only the "root" less file should be included in the packages.py list. An explanation for this follows:

You should also be aware that (as far as I know) there's no built-in way to prevent the less compiler from emitting any imported or otherwise inlined CSS (i.e. it always "statically links" libs). For example, if a less file in shared-package imports a file, and this file is also imported in your-package, there will be duplicate copies on a page that uses both shared-package and your-package. This problem is unsolved, so if you think you'll end up causing a lot of duplication, maybe look into making our packaging smarter.
Comments