Search code examples
angularjsgruntjsyeomanyeoman-generator-angular

No views present in dist when building with grunt


I have an angular app that I have scaffolded using yeoman.

When I am trying to build with grunt, no views directory is generated in dist/

This is how my GruntFile looks

htmlmin: {
      dist: {
        options: {
          collapseWhitespace: false,
          conservativeCollapse: false,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    ngtemplates: {
      dist: {
        options: {
          module: 'tweetSearchApp',
          htmlmin: '<%= htmlmin.dist.options %>',
          usemin: 'scripts/scripts.js'
        },
        cwd: '<%= yeoman.app %>',
        src: 'views/{,*/}*.html',
        dest: '.tmp/templateCache.js'
      }
    },

And this is how my grunt logs look like

Running "ngtemplates:dist" (ngtemplates) task
File .tmp/templateCache.js created.
>> Usemin has not created uglify.generated yet!

And

Running "usemin:html" (usemin) task
Replaced 2 references to assets

Running "usemin:css" (usemin) task
Replaced 2 references to assets

Running "usemin:js" (usemin) task
Replaced 2 references to assets

Running "htmlmin:dist" (htmlmin) task
Minified 2 files

But I still cannot see any views folder generated in my dist/ folder

Please help me with the configuration


Solution

  • Please have a look to this link

    https://www.npmjs.com/package/grunt-angular-templates

    Grunt is caching your HTML templates with $templateCache. That means all your Html files were included in the script*.js file which was generated in dist/scripts/script*.js.

    That is why the views directory is not being generated in dist/