I'm using pug to build a static site with some layout and module(performed by include
).
And I implement pages by extends
method, like this:
_layout.pug
html
head
block styles
body
block content
page1.pug
extends _layout.pug
block styles
link(href='some.css', rel='stylesheet')
block content
h1 some content
And I wanna build a special version for code-igniter 3(for my teammate), without any layout codes.
I think that I have 3 options, but i don't know how to do.
1. auto replace layout file by some gulp task, I think this is a flexible method,
but I don't know how to do that.
2. using some function to ignore extends by gulp-pug
, but I think it's impossible.
3. is there some gulp plugin can converse to CI's template(but i don't wanna use pug as template engine)
Thanks for your help!
Solution:
Thanks to Gibin Ealias.
With gulp-pug
, I can passing a parameter called data
, here is sample:
gulp.task('pug-with-parameter', () => {
gulp
.src('[^_]*.pug')
.pipe(
pug({
pretty: true,
data: {
testValue: 'go'
}
})
)
.on('error', handleError)
.pipe(gulp.dest('./dist/'));
});