S
S
smailenemy2016-04-26 23:32:03
gulp.js
smailenemy, 2016-04-26 23:32:03

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 question

Ask a Question

731 491 924 answers to any question