Using Grunt I would like to compile .less files coming from different dynamic sources into a single .css destination file, at a given path. For instance, my source files are organized this way:
app
|_ modules
|_ module1
| |_ branding
| |_ brand1
| | |_ file1.less
| | |_ file2.less
| |_ brand2
| |_ file1.less
| |_ file2.less
|_ module2
|_ branding
|_ brand1
| |_ file1.less
|_ brand2
|_ file1.less
And I would like to compile them in a destination like the following:
app
|_ styles
|_ branding
|_ brand1.css
|_ brand2.css
Currently I am experimenting with a grunt task definition like the following:
less:{
branding: {
files: [
{
expand: true,
cwd: "<%= yeoman.app %>/app/modules/",
src: ["**/branding/**/*.less"],
dest: "<%= yeoman.app %>/app/styles/branding/",
ext: ".css"
}
]
}
}
which clearly does not work, because it replicates the source tree.
Is it possible?
For those who are looking for a solution to a similar problem, I currently solved it using a "rename" function: