不确定我这样做是否正确......
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 文件时...是我按顺序组织任务的方式有问题还是应该添加异步运行任务的东西?
不知道该怎么办..谢谢!
最佳答案
keepalive: Keep the server alive indefinitely. Note that if this option is enabled, any tasks specified after this task will never run.
因此,您需要对“默认”分配中的任务列表重新排序:
grunt.registerTask('default', ['jade', 'compass', 'connect']);
或者类似的东西。希望有帮助;)
关于javascript - gruntfile.js - grunt.registerTask,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17148435/