我想使用实时重载在浏览器中同时预览index.html
和README.md
文件。该设置适用于单个文件,但我无法使其适用于两个文件。
grunt.initConfig({
connect: {
// Server for the index.html inside the templates
template: {
options: {
hostname: 'localhost',
port: 3001,
base: './templates/price-table/',
livereload: true
}
},
// Server for the README.md
readme: {
options: {
hostname: 'localhost',
port: 3002,
base: '.',
livereload: true
}
},
watch: {
// Watch Templates.
template: {
options: {
spawn: false,
livereload: true
},
files: ['templates/price-table/**/*.html'],
},
// Watch Readme
readme: {
options: {
spawn: false,
livereload: true
},
files: ['README.md'],
}
}
}); //initConfig
// load npm tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
// define default task
grunt.registerTask('default', ['connect:template', 'connect:readme', 'watch:template', 'watch:readme']);
设置方法是什么?