Answer the question
In order to leave comments, you need to log in
How to avoid crash when compiling jade to html?
I'm using the default jade compiler from npm.
I do something like jade -w index.jade
For every syntax or other error, the process (watch) in the console stops and I have to restart everything again, unlike stylus, which does not interrupt the watch process. How can this be avoided?
PS I put a compilation task on grunt, but as always, compilation slows down there, although nothing crashes.
Answer the question
In order to leave comments, you need to log in
Like this
// JADE
function log(error) {
console.log([
'',
"----------ERROR MESSAGE START----------",
("[" + error.name + " in " + error.plugin + "]"),
error.message,
"----------ERROR MESSAGE END----------",
''
].join('\n'));
this.end();
}
gulp.task('jade', function() {
return gulp.src(paths.src.jade)
.pipe(jade({
pretty: true,
})).on('error', log)
.pipe(gulp.dest('src/'))
.pipe(reload({
stream: true
}));
});
Try gulp, nothing slows down there, and it just prints an error .on('error', console.log).
gulp.task('jade', function() {
gulp.src(['./source/**/*.jade', '!./source/partials/*.jade'])
.pipe(jade({
pretty: true
}))
.on('error', console.log)
.pipe(prettify({
indent_char: ' ',
indent_size: 1,
indent_with_tabs: true
}))
.pipe(gulp.dest('./public/'))
.pipe(livereload(server));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question