Reputation: 480
I've set it up like Grunt says and I have the following code, grunt is watching correctly and the livereload.js is running on port 35729.
My issue is that I can't see my index.html running on the localhost. What am I missing?
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
Upvotes: 1
Views: 2532
Reputation: 22553
By default the grunt-contrib-connect server runs only as long as the grunt module is running: https://github.com/gruntjs/grunt-contrib-connect#keepalive.
Add the keepalive key to your options:
connect: {
connect: {
options: {
port: 9000,
livereload: 35729,
keepalive: true,
hostname: 'localhost'
},
Keep in mind that no other tasks will run after this one, when you use keepalive. But from your gruntfile that looks fine.
Upvotes: 1