When testing in IE8, LiveReload throws errors since web sockets is not supported. Is there a way to configure yeoman to disable LiveReload?
5 Answers
IE8 isn't supported by Yeoman, for good reason.
However, you could do what Allan describes, or you could override the server
task, by putting this in your Gruntfile:
grunt.registerTask('server', 'yeoman-server');

- 62,972
- 39
- 168
- 232
-
4Basically you are right, IE8 should be sent straight to hell, but sometimes it's just the only browser that's used in a company's intranet. However, when I do that it says *Task "yeoman-server" not found.* – acme Dec 18 '12 at 11:21
Try to use <!--[if !IE]><!--></body><!--<![endif]--><!--[if IE]></body><!--<![endif]-->
instead of </body>
.
Generator would try to replace first </body>
element and add livereload snippet before it, so code would be placed in invisible for IE space.
P.S. It`s dirty hack so use this carefuly

- 41
- 1
-
1I hate this answer. Also, after 90 mins, this is the best answer. Thank you! – Michael Cole Jul 09 '15 at 20:01
Put this in your Gruntfile:
grunt.registerHelper('reload:inject', function () {
return function inject(req, res, next) {
return next();
}});

- 1,514
- 11
- 11
-
2
-
1In 2014 it will give you an error when you run `grunt serve`: `Loading "Gruntfile.js" tasks...ERROR >> TypeError: Object # – randwa1k Feb 21 '14 at 00:43
Yes there is one I know.
- Go to your project folder and find the file
Gruntfile.js
- Open the file in a editor
- Remove the
reload:
inwatch:
It will look something like this:
// default watch configuration
watch: {
coffee: {
files: 'app/scripts/**/*.coffee',
tasks: 'coffee reload'
},
compass: {
files: [
'app/styles/**/*.{scss,sass}'
],
tasks: 'compass reload'
},
reload: {
files: [
'app/*.html',
'app/styles/**/*.css',
'app/scripts/**/*.js',
'app/images/**/*'
],
tasks: 'reload'
}
}
And after you have removed it something like this:
// default watch configuration
watch: {
coffee: {
files: 'app/scripts/**/*.coffee',
tasks: 'coffee reload'
},
compass: {
files: [
'app/styles/**/*.{scss,sass}'
],
tasks: 'compass reload'
}
}
I think i have seen a commandline flag, but I was unable to find it.

- 4,333
- 2
- 31
- 53
Yeoman Livereload consists of two parts: the middleware that inserts the livereload snippet, and the livereload target in the watch task. To disable livereload, remove both:
Livereload snippet at the top of the Gruntfile:
// Generated on ...
'use strict';
var LIVERELOAD_PORT = 35729; // <- Delete this
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT}); // <- Delete this
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
Livereload task in Watch:
watch: {
// Delete this target
livereload: {
options: {
livereload: LIVERELOAD_PORT
},
files: [
//...
]
}
}
And the middleware that inserts the snippet:
connect: {
options: {
port: 9000,
hostname: 'localhost'
},
livereload: {
options: {
middleware: function (connect) {
return [
lrSnippet, // <- Delete this middleware
mountFolder(connect, '.tmp'),
mountFolder(connect, yeomanConfig.app)
];
}
}
For updates on fixing the livereload-connect issues in Yeoman, track this issue: https://github.com/yeoman/generator-webapp/issues/63

- 10,184
- 4
- 41
- 40