I am using grunt to build my project and have the following src structure:
app/src/client/pages/user/users.js
app/src/client/pages/user/users.html
app/src/client/pages/project/projects.js
app/src/client/pages/user/projects.html
Now, I am trying to build my project to look like this:
app/dist/client/users.html
I use the contrib-htmlmin plugin and my grunt config looks like this:
htmlmin: {
options: {
removeComments: true,
collapseWhitespace: true
},
partials: {
files: [
{
expand: true,
cwd: "app/src/client/pages/*/",
dest: "app/dist/client/",
src: ["*.html"]
}
]
}
But this is not working at all, no files are being minified. Any suggestions?
As best I can tell, Grunt does not expand patterns in
cwd
, so your optionnever gets converted to an array of matching directories.
You can follow my logic for this conclusion by starting at this line in the source.
grunt.file.expandMapping
(source here) doesn't callgrunt.file.expand
on yourcwd
pattern.That doesn't mean you can't do it yourself. I've used the following pattern to accomplish something similar with
grunt-contrib-sass
when I have sass files spread out over several directories: