Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.

Add context option #56

Open
blond opened this issue Oct 1, 2016 · 0 comments
Open

Add context option #56

blond opened this issue Oct 1, 2016 · 0 comments

Comments

@blond
Copy link
Member

blond commented Oct 1, 2016

To build i18n with bem-core need provide code of i18n core to BEMContext.

Example:

const gulp = require('gulp');
const bemhtml = require('gulp-bem-xjst').bemhtml;
const I18NCode = readFileSync('path/to/core');

gulp.task('default', function () {
    return gulp.src('page.bemhtml')
        .pipe(bemhtml({
            context: { i18n: I18NCode }
        }))
        .pipe(gulp.dest('dist'));
});

This code should add BEM-XJST template to sources:

oninit(function(exports, context) {
    var BEMContext = exports.BEMContext || context.BEMContext;
    BEMContext.prototype.i18n = I18NCode;
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant