0

I am not sure why Grunt isn't generating my HTML? Is there a mistake with my gruntfile?

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-haml');
  grunt.initConfig({
    uglify: {
     my_target: {
      files: {
       'js/script.js': ['javascripts/*.js']
        } //files
      } //my_target
    }, //uglify
    sass: {
        dist: {
            options: {
                sourcemap: true,
          compass: true
        }, //options
        files:{
         'stylesheets/style.css': 'sass/style.scss'
        } //files
      } //dist
    }, //sass
    haml: {                              // Task
    dist: {                            // Target
      files: {                         // Dictionary of files
        'index.html': 'index.haml'       // 'destination': 'source'
      }
    }
  },
    watch: {
        options: { livereload: true },
        scripts: {
            files: ['javascripts/*.js'],
            tasks: ['uglify']
      }, //script
      css: {
        files: ['sass/*.scss'],
        tasks: ['sass']
      }, //sass
      html: {
        files: ['*.haml'],
        task: ['haml']
      }
    } //watch
  }) //initConfig
  grunt.registerTask('default', ['haml', 'watch']);
} //exports
Vennsoh
  • 4,853
  • 5
  • 26
  • 41

2 Answers2

0

Old question, but I had the same issue, and here's what it was for anyone's future reference.

The gruntfile that I downloaded (like this one) had 'task' instead of 'tasks'. So the watch task is running, and you'll get notified that a file has changed, but no actual tasks will be run. Correct the typo and you're back in action!

manishie
  • 5,302
  • 1
  • 20
  • 21
-1

Figure this out. There is no problem with the code itself.

It is the terminal screwing up.

Vennsoh
  • 4,853
  • 5
  • 26
  • 41
  • What do you mean the terminal is screwing up? I'm having a very similar problem. The same project runs fine on Ubuntu but generates empty files on Mac OS X. Would you mind sharing your discovery? – Fernando Apr 18 '14 at 21:13
  • I can't quite remember. But maybe try doing a fresh install of node.js again? – Vennsoh Apr 19 '14 at 22:11