Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GruntJS usemin doesn't look in subfolders

I'm using grunt and usemin with my angularjs project. Specifically my issue is concerned with usemin not revving image tags in any *.html file within a subdirectory of views.

My .html files are in the following structure

dist/
    index.html
    views/
        profile.html
        partials/
            header.html
            ...

The grunt usemin:html task is processing everything in views/ but not within any of it's subfolders. ie. partials/*

Here is my grunt config:

...
useminPrepare: {
  html: '<%= yeoman.app %>/index.html',
  options: {
    dest: '<%= yeoman.dist %>'
  }
},
usemin: {
  html: ['<%= yeoman.dist %>/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
  options: {
    dirs: ['<%= yeoman.dist %>']
  }
},
...

What I've Tried

I tried adding these options to my usemin config:

options: {
    basedir: '<%= yeoman.dist %>',
    dirs: ['<%= yeoman.dist %>/**/*']
}

But still it doesn't process any subfolder of views.

Update

Thanks to jakerella's answer noa's comment I got the following to work:

usemin: {
  html: ['<%= yeoman.dist %>/{,*/}*.html', '<%= yeoman.dist %>/views/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
  options: {
    dirs: ['<%= yeoman.dist %>']
  }
},
like image 974
iamjonesy Avatar asked Dec 31 '13 15:12

iamjonesy


1 Answers

I think you're close, but I think you'll want to use the ** glob pattern in the html target of the usemin task:

usemin: {
    html: ['<%= yeoman.dist %>/**/*.html'],
    ...
}

And you might need an expand: true in there as well (but not sure if the usemin task uses that option).

like image 169
Jordan Kasper Avatar answered Oct 17 '22 07:10

Jordan Kasper