grunt build Aborted due to warning “Destination no

2019-09-01 17:56发布

I am using Yeoman (http://yeoman.io/) and I usually just run

grunt build

in order to minify and upload my AngularJS app to the server. However for some reason I am getting a

  >> Destination not written because minified HTML was empty.

I haven't had this trouble before until now and I have not changed my Grunt file. It seems as though everything else is getting minifies just fine, even the other html files within the same /views directory. I read on this thread (grunt serve: concurrent:server aborts due to warnings) about something with SCSS but I can't seem to pin point the issue. Why can't I minify my dsit/views/main.html? Here is what it looks like in the terminal

  Running "htmlmin:dist" (htmlmin) task
  Minified dist/404.html 3.53 kB → 3.39 kB
  Minified dist/index.html 2.5 kB → 2.31 kB
  Minified dist/views/about.html 31 B → 30 B
  >> Destination not written because minified HTML was empty.
  Minified dist/views/explore.html 33 B → 32 B
  Warning: dist/views/main.html
  Parse Error: <a ng-click="nextCampaign()" class"nav-button">
      <i class="fa fa-chevron-right fa-2x"></i>
    </a>
  </nav>......... more code

Here is the "htmlmin:dist" in my Grunt file that is giving me the error

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

Here is the main.html component it is complaining about

  Parse Error: <a ng-click="nextCampaign()" class"nav-button">
      <i class="fa fa-chevron-right fa-2x"></i>
    </a>
  </nav>

  <nav class="modal-previous hidden-mobile">
    <a ng-click="previousCampaign()"class"nav-button">
      <i class="fa fa-chevron-left fa-2x"></i>
    </a>
  </nav>

1条回答
beautiful°
2楼-- · 2019-09-01 18:31

Figured it out. It was just a simple error, I left out a "=" in between

 class"nav-button" 

I simply changed it to

class="nav-button"

and everything was all good. If you ever get this error, check the line that the terminal tells you that there is a

 Parse Error: ...html...

Sometimes it is just that simple.

查看更多
登录 后发表回答