Closed axelson closed 10 years ago
The file patterns for grunt are glob style, so if it's something you can express with glob, then sure.
You can say something like src/**/*.haml
. This will find any haml file below the src
directory. Or are you looking for something else?
Okay, by mixing that syntax with the 'two' example I can get what I want.
haml: {
two: {
files: grunt.file.expandMapping(['_jekyll/**/*.haml'], 'build/', {
rename: function(base, path) {
return base + path.replace(/\.haml$/, '').replace(/_jekyll\//, '');
}
}),
options: { language: 'ruby' }
}
}
Thanks! Although I wish I didn't have to manually remove the jekyll. Is there a way around that? If I just provide something like ['*/_.haml'] grunt never completes.
Nevermind, found a wiki page that explained it. Can I add this to the REAME and submit it as a PR?
Wiki page: http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
My new config:
haml_files: {
expand: true,
flatten: false,
cwd: '_jekyll',
src: ['**/*.haml'],
dest: 'build/',
ext: '.html',
options: { language: 'ruby' }
}
Please do.
Is there a way to recursively list the haml files to build rather than directly list every folder that contains *.haml files?