簡體   English   中英

gruntfile.js-grunt.registerTask

[英]gruntfile.js - grunt.registerTask

不知道我是否做對了...

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']); 
}   

每次我運行grunt時,它只會顯示連接任務,例如在更改index.jade文件時什么都不會發生……是我按順序組織任務的方式是否有問題,還是應該添加一些運行的東西?任務異步?

不知道該怎么辦..謝謝!

Grunt Connect文檔

keepalive:無限期保持服務器活動。 請注意,如果啟用此選項,則在此任務之后指定的任何任務將永遠不會運行。

因此,您要對“默認”分配中的任務列表重新排序:

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

或類似的東西。 希望能有所幫助;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM