0

Maybe I'm missing something here but, I'm new on grunt and I don't know why my configuration grunt file is not executing or producing my compress file.

Gruntfile

'use strict';

module.exports = function (grunt) {

  grunt.initConfig({
    connect: { // Conexión al servidor local
      server: {
        options: {
          port: 9000,
          base: 'app/'
        }
      }
    },
    watch: { // Configuración de 'watch' con livereload
      project: {
        files: ['app/**/*.js', 'app/**/*.html', 'app/**/*.json', 'app/**/*.css'],
        options: {
          livereload: true
        }
      }
    },
    uglify: {
      my_target: {
        files: {
          'app-dist/js/app.min.js': 'app/app.js'
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify'); 

  grunt.registerTask('default', ['connect', 'watch', 'uglify']);

};

I'm not getting any error.

napstercake
  • 1,815
  • 6
  • 32
  • 57

1 Answers1

2

Watch is a blocking task and prevents uglify from being run. Changing an order of tasks should help

grunt.registerTask('default', ['uglify', 'connect', 'watch']);

Note: In most of the cases you would want to put it to the very end of your task chain.

Andriy Horen
  • 2,861
  • 4
  • 18
  • 38