Skip to content

Commit

Permalink
#329 Use bemhtml from bem-xjst
Browse files Browse the repository at this point in the history
  • Loading branch information
tadatuta committed Dec 19, 2013
1 parent 9a66b94 commit 07472bb
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 119 deletions.
10 changes: 0 additions & 10 deletions .bem/lib/bemhtml.js

This file was deleted.

54 changes: 0 additions & 54 deletions .bem/lib/bemhtml/api.js

This file was deleted.

37 changes: 0 additions & 37 deletions .bem/lib/bemhtml/cache.js

This file was deleted.

20 changes: 14 additions & 6 deletions .bem/techs/bemhtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,20 @@ exports.techMixin = {
getCompiledResult : function(sources) {
sources = sources.join('\n');

var BEMHTML = require('../lib/bemhtml');
return BEMHTML.translate(sources, {
devMode : process.env.BEMHTML_ENV == 'development',
cache : process.env.BEMHTML_CACHE == 'on',
exportName : 'BEMHTML'
});
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'
});
},

getExportName: function() {
return 'BEMHTML';
}

};
10 changes: 2 additions & 8 deletions .bem/techs/bemtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@ exports.techMixin = {
return ['bemtree'];
},

getCompiledResult : function(sources) {
sources = sources.join('\n');

var BEMHTML = require('../lib/bemhtml');
return BEMHTML.translate(sources, {
devMode : process.env.BEMTREE_ENV == 'development',
exportName : 'BEMTREE'
});
getExportName: function() {
return 'BEMTREE';
}

};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var ASSERT = require('assert'),
FS = require('fs'),
PATH = require('path'),
BEMHTML = require('../../../../.bem/lib/bemhtml'),
BEMHTML = require('bem-xjst/lib/bemhtml'),
resolve = PATH.resolve.bind(null, __dirname),
cores = [
'../_dummy/i-bem__i18n_dummy_yes.bemhtml',
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/i-bem/i-bem.test.bemhtml/basic-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var assert = require('assert'),
bemhtml = require('../../../.bem/lib/bemhtml');
bemhtml = require('bem-xjst/lib/bemhtml');

suite('BEMHTML Compiler', function() {
function unit(name, src, data, dst) {
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/i-bem/i-bem.test.bemhtml/i-bem-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var assert = require('assert'),
fs = require('fs'),
path = require('path'),
bemhtml = require('../../../.bem/lib/bemhtml'),
bemhtml = require('bem-xjst/lib/bemhtml'),
iBem = fs.readFileSync(path.resolve(
__dirname,
'../i-bem.bemhtml'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "MIT",
"dependencies": {
"ym": "0.0.12",
"bem-xjst": "~0.3.1",
"bem-xjst": "0.4.0",
"bemhtml-compat": "~0.0.4",
"bem-environ": "~1.2.0"
},
Expand Down

0 comments on commit 07472bb

Please sign in to comment.