Skip to content

Commit

Permalink
ENB config: was simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
remnev committed Apr 17, 2015
1 parent d80d06f commit 5f6e83d
Showing 1 changed file with 31 additions and 63 deletions.
94 changes: 31 additions & 63 deletions .enb/make.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,38 @@
var path = require('path'),
PLATFORMS = {
'common' : ['common']
};

module.exports = function(config) {
var platforms = ['common'];

config.includeConfig('enb-bem-tmpl-specs');

configureSets(platforms, {
tmplSpecs : config.module('enb-bem-tmpl-specs').createConfigurator('tmpl-specs')
});

function configureSets(platforms, sets) {
platforms.forEach(function(platform) {
sets.tmplSpecs.configure({
destPath : platform + '.tmpl-specs',
levels : getSpecLevels(platform),
sourceLevels : getLevels(platform),
coverage : true,
engines : {
bh : {
tech : 'enb-bh/techs/bh-server-include',
options : {
jsAttrName : 'data-bem',
jsAttrScheme : 'json',
sourcemap : true
}
},
'bemhtml-dev' : {
tech : 'enb-bemxjst/techs/bemhtml-old',
options : { devMode : true }
},
'bemhtml-prod' : {
tech : 'enb-bemxjst/techs/bemhtml-old',
options : { devMode : false }
config.module('enb-bem-tmpl-specs')
.createConfigurator('tmpl-specs')
.configure({
destPath : 'common.tmpl-specs',
levels : ['common.blocks'],
sourceLevels : [
{
path : 'libs/bem-core/common.blocks',
check : false
},
{ path : 'common.blocks', check : true }
],
coverage : {
engines : ['bh']
},
engines : {
bh : {
tech : 'enb-bh/techs/bh-server-include',
options : {
jsAttrName : 'data-bem',
jsAttrScheme : 'json',
sourcemap : true
}
},
'bemhtml-dev' : {
tech : 'enb-bemxjst/techs/bemhtml-old',
options : { devMode : true }
},
'bemhtml-prod' : {
tech : 'enb-bemxjst/techs/bemhtml-old',
options : { devMode : false }
}
});
}
});
}
};

function getLevels(platform) {
var levels = [];

PLATFORMS[platform].forEach(function(name) {
levels.push({
path : path.join('libs', 'bem-core', name + '.blocks'),
check : false
});
});

PLATFORMS[platform].forEach(function(name) {
levels.push(name + '.blocks');
});

return levels;
}

function getSpecLevels(platform) {
var levels = [];

PLATFORMS[platform].forEach(function(name) {
levels.push(name + '.blocks');
});

return levels;
}

0 comments on commit 5f6e83d

Please sign in to comment.