felixzapata / gulp-i18n-pug

Gulp plugin to compile Pug templates with internationalization support based on JS/JSON/YAML files
MIT License
28 stars 4 forks source link

Relative paths are not considered when option "localeExtension" false #5

Closed Akiyamka closed 6 years ago

Akiyamka commented 6 years ago

Example file structure:

gulpfile.js
src
  ├─ pages
  ├─ index.html
  ├─ about.html
  └─ blog
       ├─ index.html
       └─ article.html

After the task:

gulp.task('html', function () {
  var options = {
    i18n: {
      locales: 'locales/en_US.json',
      localeExtension: false,
      dest: 'translations/',
    },
    client: false,
    pretty: false
  };

  return gulp.src('src/pages/**/*.pug')
    .pipe(pugI18n(options))
    .pipe(gulp.dest(options.i18n.dest))

Will look like:

translations
  └─ en_US
        ├─ index.html
        ├─ about.html
        ├─ index1.html
        └─ article.html

Expected behavior: that the structure should be preserved, and result look like:

translations
└─ en_US
       ├─ pages
       ├─ index.html
       ├─ about.html
       └─ blog
             ├─ index.html
             └─ article.html
felixzapata commented 6 years ago

I will take a look ASAP.

felixzapata commented 6 years ago

@Akiyamka if you have the fix, please make a pull request please

Akiyamka commented 6 years ago

Already do. Not sure if this is the best way to fix the problem, but at least it works

felixzapata commented 6 years ago

I will take a look to the pull request. I was working in a similar solution.

felixzapata commented 6 years ago

Hi @Akiyamka , thanks for the pull request. I've just published the version 1.0.3.