这是我的Gruntfile.js
。
module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
dirs: {
js: ['app/js/**/*.js', '!app/js/libs/**/*.js'],
jshint: ['Gruntfile.js','app/js/**/*.js','!app/js/libs/**/*.js'],
html: ['app/index.html'],
css: ['app/styles/**/*.css'],
less: ['app/styles/**/*.less'],
tests: ['test/**/*.js']
},
hbs: {
templateExtension : 'hbs'
},
connect:{
development: {
port: 9000,
base: 'app',
keepalive: true,
livereload: true
}
}
});
grunt.registerTask('server', ['less', 'connect', 'watch', 'open:dev']);
};
当我启动服务器时,它在端口8000上运行。根据我的理解,我在connect:developement:port
属性中指定端口。是什么让它在8000端口上运行?
答案 0 :(得分:3)
尝试将连接后缀更改为开发:
grunt.registerTask('server', ['less', 'connect:development', 'watch', 'open:dev']);
您可能还需要指定选项:
connect: {
development: {
options: {
port: 9000,
base: 'app',
keepalive: true,
livereload: true
}
}
}