I'm trying gulp and in particular the gulp-pug plugin to compile Pug. It does not seem to have much science to make it work but nevertheless there is no way.
I'm not doing any project, I'm just trying the 'task runner' Gulp and in particular the Gulp-pug plugin (which is what does not work for me)
My gulpfile is this:
'use strict'
var gulp = require('gulp');
var browserSync = require("browser-sync").create();
var pug = require('gulp-pug')
var sass = require('gulp-ruby-sass');
gulp.task('sass', function () {
sass('./scss/**/*.scss')
.on('error', sass.logError)
.pipe(gulp.dest('./css'))
});
gulp.task('pug', function () {
gulp.src('./pug/*.pug')
.pipe(pug())
.pipe(gulp.dest('./'))
});
gulp.task('serve', function() {
browserSync.init({
server: "./"
});
gulp.watch("./scss/**/*.scss", ['sass']);
gulp.watch("./pug/**/*.pug", ['pug']);
gulp.watch(["./*.html", "./css/*.css"]).on('change', browserSync.reload);
gulp.watch("./js/*.js").on('change', browserSync.reload);
});
gulp.task('default', ['serve']);
Of course I have Pug installed and it works perfectly. I used it with grunt and from console without problem.
Do not throw any errors, just put
Starting 'pug'...
Finished 'pug' after 12 ms
But no traces of .html
I understand that you are not connecting with Pug and therefore does not do anything. but I do not know how to solve it.
I add a little more information.
The file that should be compiled (or traspilar) is the following:
doctype html
html(lang="es")
head
meta(charset="utf-8")
title Prueba
body
.wrapper
header.hidden
h1 HOLA MUNDO
That as it looks does not have anything strange.
and the file structure.
/:.
| gulpfile.js
| package.json
|
+---css
| style.css
|
+---node_modules
| +--- etc...
|
\---pug
| index.pug
I omit all the contents of the 'node modules' folder because it is too long and does not add much to this one.
Greetings