Skip to content

Instantly share code, notes, and snippets.

@nuysoft
Created September 3, 2013 07:52
Show Gist options
  • Save nuysoft/6420832 to your computer and use it in GitHub Desktop.
Save nuysoft/6420832 to your computer and use it in GitHub Desktop.
监听开发目录下文件的变化,自动更新文件到部署目录。可以解决发开过程中: 1) Window 下 build、deploy、debug 繁琐的步骤, 2) Mac 下 JBoss 不支持软链接(ln -s)。
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
dev: {
files: ['../dev/zuanshi-site-web/src/main/webapp/**/**'],
tasks: ['copy']
}
},
copy: {
dev: {
files: [{
expand: true,
cwd: '../dev/zuanshi-site-web/src/main/webapp/app/',
src: ['**'],
dest: '../dev/zuanshi-site-web/target/zuanshi-site.war/app/'
}, {
expand: true,
cwd: '../dev/zuanshi-site-web/src/main/webapp/assets/',
src: ['**'],
dest: '../dev/zuanshi-site-web/target/zuanshi-site.war/assets/'
}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['copy', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment