Frage

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 %>']
  }
},
War es hilfreich?

Lösung

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).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top