F
F
Froggyweb2021-07-15 16:07:32
JavaScript
Froggyweb, 2021-07-15 16:07:32

Gulp different dist i18n folders?

I use gulp-i18n-pug for localization.
How to display the default language for example English in another folder?
like there is gulp-if but I can't figure out how to catch the current language that is being processed.
more or less like this

public/
    index.html  // your site's default homepage
    404.html  // your site's custom 404 page

    localized-files/
        fr/
            index.html
            404.html
        fr_ca/
            index.html


current config
function html() {
    return (
      gulp
        .src([source.src + "pug/[^_]*.pug"])
        .pipe(newer(source.dist + "*.html"))
        .pipe(plumber())
        .pipe(
          pug({
            i18n: {
              dest: source.dist,
              locales: "./_src/locales/*.*",
              defaultLocale: "en",
            },
            pretty: true, // Pug option
            plugins: [pugbem],
          })
        )
        // .pipe(replace(new RegExp("/../+/", "g"), "/"))
        .pipe(gulp.dest(source.dist))
        .pipe(browsersync.stream())
    );
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question