Answer the question
In order to leave comments, you need to log in
How to compile pages of PUG files but not modules?
Have a project structure
src
modules
module-name
module-name.pug
pages
index.pug
www
html
h1 Привет, мир.
include ../modules/module-name/module-name.pug
const gulp = require('gulp');
const pug = require('gulp-pug');
gulp.task('pages', function() {
return gulp.src(['src/**/*.pug'])
.pipe(pug({
doctype: 'html',
pretty : true,
}))
.pipe(gulp.dest('www/html'))
});
ctrl+s
a task is launched in a module or page. src/pages/*.pug
src/modules/**/*.pug
watch
for all pug files src/**/*.pug
'!src/modules/**/*.html'
'www/html'
Answer the question
In order to leave comments, you need to log in
const gulp = require('gulp');
const pug = require('gulp-pug');
gulp.task( 'pages', function() {
return gulp.src( 'src/pages/*.pug' )
.pipe(pug({
doctype: 'html',
pretty : true,
}))
.pipe(gulp.dest( 'www/html' ))
});
// watch [ 'src/pages/*.pug', 'src/modules/*/*.pug' ]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question