Answer the question
In order to leave comments, you need to log in
Why is gulp-swig not compiling html?
HTML must be compiled on the fly. Now I have a livereload going on, but I can't compile on the fly in public. But when you restart gulp compiles once. What is the problem?
'use strict';
var gulp = require('gulp'),
connect = require('gulp-connect'),
swig = require('gulp-swig');
gulp.task('swig', function() {
gulp.src('src/pages/*.html')
.pipe(swig())
.pipe(gulp.dest('public/'))
.pipe(connect.reload());
});
gulp.task('watch', function() {
gulp.watch('src/pages/**/*.html', ['swig']);
});
gulp.task('connect', function() {
connect.server({
root: 'public',
livereload: true
});
});
gulp.task('default', ['swig', 'watch', 'connect']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question