Open hungtcs opened 6 years ago
Emm. got same..
and my task..
exports.njk = function njk(){
return gulp.src(GULPCONFIG.filepath.njk, { base: GULPCONFIG.filepath.dev })
.pipe(nunjucks.compile())
.pipe(through.obj((chunk, enc, callback) => {
chunk.extname = '.html';
return callback && callback(null, chunk);
}))
.pipe(gulp.dest(GULPCONFIG.filepath.dist));
};
how to fixed it?
Duplicate https://github.com/sindresorhus/gulp-nunjucks/issues/14
Unfortunately in gulp-nunjucks is no option for relative path to templates.
The gulp-nunjucks-render has a better API and allows to specify the path from which all the templates will be resolved:
import gulpNunjucksRender from 'gulp-nunjucks-render';
export function buildTemplates() {
return src('templates/**/*.nj')
.pipe(gulpNunjucksRender({
path: 'templates/',
}))
.pipe(dest('dist/'))
;
}
This is my project tree view:
And the login.njk