LESS Grails Asset Pipeline
less-asset-pipeline is a plugin that provides LESS support for the asset-pipeline static asset management plugin.
For more information on how to use asset-pipeline, visit here.
Simply create files in your standard
assets/stylesheets folder with extension
.css.less. You also may require other files by using the following requires syntax at the top of each file or the standard LESS import:
/* *= require test *= require_self *= require_tree . */ /*Or use this*/ @import 'test'
Including Less files into your GSP files is easy but there are a few things worth mentioning. Say we have a file called
application.less. You would include it into your gsp by its compiled extension instead of its original extension. aka, use
.css instead of
<head> <asset:stylesheet src="application.css"/> </head>
This plugin now defaults to compiling your less files with less4j instead of the standard less compiler. To Turn this off you must adjust your config:
grails.assets.less.compiler = 'standard'
During war build your less files are compiled into css files. This is all well and good but sometimes you dont want each individual less file compiled, but rather your main base less file. It may be best to add a sub folder for those LESS files and exclude it in your precompile config...
grails.assets.excludes = ["mixins/*.less"]