Gruntjs Grunt localhost:9000/index.html不';跑不动
我像Grunt说的那样设置了它,我有以下代码,Grunt正在正确地监视,livereload.js正在35729端口上运行 我的问题是看不到index.html在本地主机上运行。 我错过了什么Gruntjs Grunt localhost:9000/index.html不';跑不动,gruntjs,grunt-contrib-watch,grunt-contrib-connect,Gruntjs,Grunt Contrib Watch,Grunt Contrib Connect,我像Grunt说的那样设置了它,我有以下代码,Grunt正在正确地监视,livereload.js正在35729端口上运行 我的问题是看不到index.html在本地主机上运行。 我错过了什么 module.exports = function(grunt) { grunt.initConfig({ compass: { dev: { options: { config:
module.exports = function(grunt) {
grunt.initConfig({
compass: {
dev: {
options: {
config: 'config.rb'
}
}
},
watch: {
css: {
files: 'sass/*.scss',
tasks: ['sass'],
options: { livereload: true }
},
livereload: {
options: { livereload: true },
files: [
'{,*/}*.html',
'*.html',
'assets/images/{,*/}*',
'assets/js/*.js'
]
},
options: {
livereload: true,
},
html: {
options: { livereload: true },
files: ['*.html']
},
sass: {
options: { livereload: true },
files: ['sass/*.scss'],
tasks: ['compass:dev']
},
options: {
livereload: true
},
js: {
options: { livereload: true },
files: ['assets/js/*.js'],
tasks: ['jshint']
},
images: {
options: { livereload: true },
files: ['assets/images/*.*']
},
fontsicons: {
options: { livereload: true },
files: ['assets/images/icons/**/*.{svg,eot,woff,ttf,woff2,otf}'],
tasks: ['copy:fontsicons']
}
},
connect: {
connect: {
options: {
port: 9000,
livereload: 35729,
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'app'
]
}
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.registerTask('default', ['watch','compass','connect']);
} //exports
默认情况下,grunt contrib connect服务器仅在grunt模块运行时运行: 将keepalive键添加到选项中:
connect: {
connect: {
options: {
port: 9000,
livereload: 35729,
keepalive: true,
hostname: 'localhost'
},
请记住,当您使用keepalive时,在此任务之后将不会运行其他任务。但是从你的gruntfile上看,它看起来不错。你试过端口:9000吗?@RobertMoskal我的locahost是localhost:9000/index.htmltanks查看此内容时,仍然会给我“此网页不可用”不确定原因,looks看不到或找不到我的index.html