bmbrands/theme_bootstrap — pull request #71 by jobyh (2013-11-11 08:55:56+00:00)
Title: Grunt tasks

Nice work with the Bootstrap theme - really glad Moodle has recieved some core CSS preprocessor-love!

Following some discussion at work with fellow developers on compiling the .less files within the theme I put together a Gruntfile and package.json to demonstrate compiling via node using the (Grunt task runner)[http://gruntjs.com/] with a watch task to poll the less directory for changes.

While it's possible to compile using recess (as per the usage instructions), using Grunt has the following benefits:

- standard configuration can be packaged up with the repository (as well as including dependencies via package.json) and therefore invoked without the need to pass in path arguments or use output redirection.
- Watch multiple files (recompiles when any .less file under the less directory is changed)
- Easy to add / extend the commands to do more (Grunt's just a task runner)

Might also be interesting to add some more tasks such as a less:dev build to output uncompressed CSS for easier inspection during development etc. in future?

The main downside I can think of at the moment is that the grunt-contrib-less plugin formats compressed output very slightly differently to recess (& therefore the included CSS files) but I guess if the user's compiling Less then presumably they're intentionally making changes anyway. Just means that on initial compile both moodle.less and editor.less show as modified in git regardless of whether they have been.

The Gruntfile and package.json are lightweight enough that they can simply be ignored if the developer wants to use their own method for compiling such as recess or GUI-based tool.

I've put installation / usage instructions into the file phpdoc header.

Cheers