Pregunta

Not sure if I'm doing it right...

module.exports = function(grunt) {
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json') ,
    connect: {
        server: {
            options: {
                port: 8001 ,
                hostname: 'localhost' ,
                base: 'www-root/app/public' ,
                keepalive: true
            }
        }
    } ,
    jade: {
        files: {
            src: 'app/components/jade/index.jade' ,
            dest: 'app/public/index.html' 
        }
    } ,
    compass: {
        options: {
            config: 'config.rb'
        }
    } ,
    watch: {
        css: {
            files: '**/*.sass' ,
            tasks: ['sass'] ,
            options: {
                livereload: true
            }
        } ,
        jade: {
            files: 'app/components/**/*.jade' ,
            tasks: ['jade'] ,
            options: {
                livereload: true
            }
        }
    } 
});

grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', ['connect', 'jade', 'compass', 'watch']); 
}   

Every time I run grunt, it only shows me the connect task and nothing else happens for example when I change my index.jade file... Is it a problem with the way I organized the tasks in order or should I add something that runs the tasks asynchronously?

Not sure what to do.. Thanks!

¿Fue útil?

Solución

Grunt Connect Documentation

keepalive: Keep the server alive indefinitely. Note that if this option is enabled, any tasks specified after this task will never run.

So you're going to want to reorder the task list in your 'default' assignment:

grunt.registerTask('default', ['jade', 'compass', 'connect']);

Or something of that sort. Hope that helps ;)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top