Reputation: 2261
I am getting my head around grunt and trying to run my site through grunt and connect. I have a gruntfile like this:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task(s).
grunt.registerTask('default', ['connect:livereload','watch']);
};
The problem is when I run grunt I get an error:
Running "connect:livereload" (connect) task
Warning: undefined is not a function Use --force to continue.
Aborted due to warnings.
How can I get grunt running ?
Upvotes: 0
Views: 1525
Reputation: 11275
In the project I am currently working on I decided to change the plugin to BrowserSync. It is easy to configure and does its' job.
BrowserSync website: http://www.browsersync.io/docs/grunt/.
The configuration is easy and it is given on their website so I am not going to copy it here. Maybe if you have difficulties with grunt-contrib-connect
you can try this one.
Upvotes: 0
Reputation: 140
I can see that you call appConfig.app
(probably c/p from a yeoman generated project) but you never created it. That could be a hint, because the rest of your code seems correct.
Upvotes: 1