Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/02/2014, 10:56
Avatar de nanotime
nanotime
 
Fecha de Ingreso: noviembre-2011
Ubicación: Cd. Guayana
Mensajes: 145
Antigüedad: 12 años, 6 meses
Puntos: 6
Pregunta Task "compile" not found en grutnJS

Estoy tratando de habilitar el task watch en grunt porque es un fastidio tener que correr grunt cada vez que quiero compilar y darme cuenta de que tengo como 20 errores, obviamente prefiero que me salte a decirme ¡Epa tienes un error! cuando lo cometo.

En fin, el watch funciona de cierto modo, si inicializa y si está "observando" el directorio, pero tengo dos problemas:

Declaro que observe varios directorios pero observa solo uno, aunque en el modo verbose me indica que efectivamente está observando a todos, hago cambios y solo reacciona con el de javascript, dejando en nada a los de jade y los de stylus.

El otro error, este si me tira un log, es el siguiente:

Código:
Running "watch" task
Waiting...OK
>> File "app/js/src/tareasController.coffee" changed.

Warning: Task "compile" not found. Use --force to continue.

Aborted due to warnings.
Mis carpetas son:

http://imgur.com/jjvyWoX (lo dejo en una imagen para que quede mas claro

y este es el gruntfile:

Código:
module.exports = (grunt) ->
  grunt.initConfig
      pkg: grunt.file.readJSON('package.json')

      coffee:
        compile:
          options:
            bare: true
          expand: true,
          flatten: true,
          cwd: 'app/js'
          src: ['**/*.coffee']
          dest: 'app/js/lib'
          ext: '.js'

      coffeelint:
        app: ['app/js/**/*.coffee', 'app/tests/**/*.coffee']

      jade:
        compile:
          options:
              pretty: true
          files:
              [
                expand: true
                cwd: 'app/views'
                src: '**/*.jade'
                dest: 'app/views/lib/'
                ext: '.html'
              ]
        compileIndex:
          options:
            pretty: true
          files: 'app/index.html': ['app/index.jade']

      stylus:
        compile:
          options:
            paths: ['/usr/local/lib/node_modules/jeet']
            import: ['index']
          files:
            'app/styles/css/styles.css': ['app/styles/**/*.styl']

      watch:
        coffee:
          files: 'app/js/**/*.coffee'
          tasks: 'compile'
        stylus:
          files: 'app/styles/**/*.styl'
          tasks: 'compile'
        jade:
          files: ['app/views/*.jade', 'app/index.jade']
          tasks: ['compile', 'compileIndex']

  grunt.loadNpmTasks 'grunt-contrib-coffee'
  grunt.loadNpmTasks 'grunt-coffeelint'
  grunt.loadNpmTasks 'grunt-contrib-jade'
  grunt.loadNpmTasks 'grunt-contrib-stylus'
  grunt.loadNpmTasks 'grunt-contrib-watch'

  # grunt.registerTask 'default', ['coffee', 'jade', 'stylus']
  grunt.registerTask 'default', ['watch:coffee', 'watch:stylus', 'watch:jade']
El output con la opción -v es este:

Código:
Initializing
Command-line options: --verbose

Reading "Gruntfile.coffee" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-contrib-coffee" local Npm module tasks.
Reading /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-coffee/package.json...OK
Parsing /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-coffee/package.json...OK
Loading "coffee.js" tasks...OK
+ coffee

Registering "grunt-coffeelint" local Npm module tasks.
Reading /home/nano/Dev/angular-tutorial/node_modules/grunt-coffeelint/package.json...OK
Parsing /home/nano/Dev/angular-tutorial/node_modules/grunt-coffeelint/package.json...OK
Loading "coffeelint.js" tasks...OK
+ coffeelint

Registering "grunt-contrib-jade" local Npm module tasks.
Reading /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-jade/package.json...OK
Parsing /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-jade/package.json...OK
Loading "jade.js" tasks...OK
+ jade

Registering "grunt-contrib-stylus" local Npm module tasks.
Reading /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-stylus/package.json...OK
Parsing /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-stylus/package.json...OK
Loading "stylus.js" tasks...OK
+ stylus

Registering "grunt-contrib-watch" local Npm module tasks.
Reading /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-watch/package.json...OK
Parsing /home/nano/Dev/angular-tutorial/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Loading "Gruntfile.coffee" tasks...OK
+ default

No tasks specified, running default tasks.
Running tasks: default

Running "default" task

Running "watch:coffee" (watch) task
Waiting...Verifying property watch exists in config...OK
Verifying property watch.coffee.files exists in config...OK
Watching app/js/src/tareasController.coffee for changes.
Ya he estado leyendo en stackoverflow, la documentación y ya probé los módulos independientemente y funcionan, ¿Qué estoy haciendo mal?

PD: si se dan cuenta, solo observa un directorio, aunque le dije que observara varios.