Closed tadatuta closed 8 years ago
@apsavin can you describe cases when you don't need Vow
with BEMTREE
?
I always need Vow with BEMTREE, but why we need to inline it? I just require
BEMTREE file and Vow inside BEMTREE is the same Vow that all other blocks use, from ym
modules system.
Example of current state
bemtreeTemplate = fs.readFileSync(path.join(pathToBundle, bundle + '.bemtree.js'), 'utf-8'),
context = vm.createContext({
console: console,
Vow: Vow,
qs: Querystring,
require: require
});
vm.runInContext(bemtreeTemplate, context);
TODO: find some more examples to summarise
@tadatuta should I give you an example of how I use it? I just build a node.js + bemtree so I have a file like this
require('path/to/ym');
require('path/to/some/block');
// ...
require('./bundleName.bemtree.js');
and then I'm able to use bemtree:
modules.define('some-block', ['BEMTREE'], func...)
so I don't use vm
and don't use global variables into BEMTREE.
@apsavin how do you handle cache? when node.js file is changed won't it trigger BEMTREE templates recompilation?
@tadatuta we use luster-guard for such tasks (but of course, this is not the only solution)
@narqo I don't understand how can it help when bemtree and node.js code is in the same bundle.
@tadatuta I use bem-tools + gulp + gulp-watch and I see no problem with templates' recompilation.
All issues about bem-tools are obsolete now.
I hope, there will be an option for users to avoid such inlining.