bem / gulp-bem

Usefull gulp modules and plugins to work with BEM methodology
https://bem.info
26 stars 4 forks source link

Fixed folder structure crushing in bem-xjst #34

Open IkorJefocur opened 4 years ago

IkorJefocur commented 4 years ago

When new file object adding by "this.push" instead of changing input file, it's relative path changing. So when i using glob pattern like this: "\*\*/\*.bemjson.js", and have multiple folders with bemjson files, folder structure doesn't saves.

For example, i have gulp task like this:

gulp
    .src('layouts/**/*.bemjson.js')
    .pipe(toHtml(gulp
        .src(files.src.tmpls)
        .pipe(concat('blocks/*/*.bemhtml.js'))
        .pipe(bemhtml())
    ))
    .pipe(gulp.dest('prod/layouts'));

And my folder structure:

layouts
 - pages
  - index.bemjson.js
 - parts
  - header.bemjson.js

In output, i will have structure like this:

layouts
 - index.html
 - header.html

I'm not pro in creating gulp plugins, but i tried to fix this problem just by changing path and contents of source ".bemjson" file, instead of creating new file. And it works! So now i have the same folder structure in input and output.

This is fixed output structure:

layouts
 - pages
  - index.html
 - parts
  - header.html