I'm trying to run a project on Ubuntu, which uses Nunjucks, and the gulp-nunjucks-render
plugin is used to render the Nunjucks templates.
The developers were mainly using this project on Windows and Mac OS, so there was no issue when including files without respecting the case sensitivity, but this causes issues on Ubuntu, as it seems this plugin fails to include some files when they have a different casing in their names.
For example, I have this file: m-figures.njk
, but in the code we have: {% import '../m-Figures.njk' as figures %}
, in this case I get this error:
Plumber found unhandled error:
Template render error in plugin "gulp-nunjucks"
Message:
(unknown path)
Error: template not found: ../m-Figures.njk
For my gulp task it goes like this:
gulp.task("nunjucks", () => {
return gulp
.src([src_folder + "pages/**/*.njk"])
.pipe(plumber())
.pipe(
data(() =>
JSON.parse(fs.readFileSync(src_folder + "datas/dist/data.json"))
)
)
.pipe(nunjucks())
.pipe(beautify.html({ indent_size: 2 }))
.pipe(gulp.dest(dist_folder))
.pipe(browserSync.stream({match: '**/*.html'}));
});
Is there a solution I can add to my gulp task to solve this issue?
Edit
Actually, this is a global issue of gulp as gulp-sass
also fails on case sensitive file systems