gulp-bem / gulp-bem-xjst

DEPRECATED repository, moved to https://github.com/bem/gulp-bem/tree/master/packages/gulp-bem-xjst
MIT License
6 stars 3 forks source link

bem-xjst API? #116

Open nicothin opened 7 years ago

nicothin commented 7 years ago

Tell me please, how can I transfer the settings in bem-xjst? My gulpfile:

const gulp = require('gulp');
const concat = require('gulp-concat');
const bemxjst = require('gulp-bem-xjst');
const bemhtml = bemxjst.bemhtml;
const bemtree = bemxjst.bemtree;

gulp.task('bemhtml', function() {
  return gulp.src('./blocks/**/*.bemhtml.js')
  .pipe(concat('temp-all.bemhtml.js'))
  .pipe(bemhtml())
  .pipe(gulp.dest('temp/')); // один хрен, будет сохранен в корень проекта. TODO: выяснить почему
});

I tried:

const bemhtml = bemxjst.bemhtml.compile(function() {
    }, {
        naming: {
            mod: '--'
        }
    });

But I'm getting an error in the terminal: TypeError: bemxjst.bemhtml.compile is not a function

qfox commented 7 years ago

Well, it should be possible to pass opts into the function inside pipe:

  .pipe(bemhtml({ HERE }))

It's the place where we creating transform stream with bemxjst.bemhtml.compile inside. Here: https://github.com/gulp-bem/gulp-bem-xjst/blob/master/index.js#L49