How to use the bem-xjst/lib/bemhtml.generate function in bem-xjst

To help you get started, we’ve selected a few bem-xjst examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bem / bem-core / .bem / techs / bemhtml.js View on Github external
getCompiledResult : function(sources) {
        sources = sources.join('\n');

        var BEMHTML = require('bem-xjst/lib/bemhtml'),
            exportName = this.getExportName(),
            optimize = process.env[exportName + '_ENV'] !== 'development';

        return BEMHTML.generate(sources, {
            wrap : true,
            exportName : exportName,
            optimize : optimize,
            cache : optimize && process.env[exportName + '_CACHE'] === 'on'
        });
    },
github apsavin / bnsf / .bem / techs / bemtree.js View on Github external
getCompiledResult: function (sources) {
        sources = sources.join('\n');

        var BEMHTML = require('bem-xjst/lib/bemhtml'),
            exportName = this.getExportName(),
            optimize = process.env[exportName + '_ENV'] !== 'development',
            code = BEMHTML.generate(sources, {
                wrap: false,
                exportName: exportName,
                optimize: optimize,
                cache: optimize && process.env[exportName + '_CACHE'] === 'on'
            });

        var deps = this.getModulesDeps(),
            modulesDeps = deps ? ', ' + JSON.stringify(Object.keys(deps)) : '',
            modulesProvidedDeps = deps ? ', ' + Object.keys(deps).map(function (module) {
                var providedName = deps[module];
                return providedName === true ? module : providedName;
            }).join(', ') : '';

        return '(function(g) {\n' +
            '  var __bem_xjst = function(exports' + modulesProvidedDeps + ') {\n' +
            '     ' + code + ';\n' +

bem-xjst

Declarative Template Engine for the browser and server

MPL-2.0
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis