Answer the question
In order to leave comments, you need to log in
How to set up a static site generation with two locales in gulp?
Good afternoon!
There is a site, completely static - html, css and some javascript. Broken down into Jade templates, built with gulp.
Not so long ago, there was a need to localize it into another language, leaving at the same time the Russian version.
After weighing all the implementation options, I came to the conclusion that the templates in a good way should remain common, and the information provided in them is different. I would like to split the structure so that in the main template one or another include from the directory of the corresponding locale is connected through the control logic, and at the output it is placed in out / en and out / ru, respectively.
Tell me how this can be implemented at the collector level and at the jade level. In a good way, without that when gulp-watchers are launched, both locales are collected into statics at once, if changes occur in the layout, so as not to edit each separately.
Thank you.
Answer the question
In order to leave comments, you need to log in
You can pass data to jade templates when compiling.
To get started, do 2 tasks to build templates:
gulp.task('templates:ru', (cb) => {
gulp.src(config.src)
.pipe(jade({
data: dataRu,
}))
.pipe(gulp.dest(config.destRu))
.on('end', () => {
cb(null);
});
});
gulp.task('templates:en', (cb) => {
gulp.src(config.src)
.pipe(jade({
data: dataEn,
}))
.pipe(gulp.dest(config.destEn))
.on('end', () => {
cb(null);
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question