bem / bem-core

BEM Core Library
https://ru.bem.info/technologies/classic/i-bem/
Other
276 stars 95 forks source link

bem-tools: Build bemtree with Vow inlined #832

Closed tadatuta closed 8 years ago

apsavin commented 9 years ago

I hope, there will be an option for users to avoid such inlining.

tadatuta commented 9 years ago

@apsavin can you describe cases when you don't need Vow with BEMTREE?

apsavin commented 9 years ago

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.

tadatuta commented 9 years ago

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);
tadatuta commented 9 years ago

TODO: find some more examples to summarise

apsavin commented 9 years ago

@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.

tadatuta commented 9 years ago

@apsavin how do you handle cache? when node.js file is changed won't it trigger BEMTREE templates recompilation?

narqo commented 9 years ago

@tadatuta we use luster-guard for such tasks (but of course, this is not the only solution)

tadatuta commented 9 years ago

@narqo I don't understand how can it help when bemtree and node.js code is in the same bundle.

apsavin commented 9 years ago

@tadatuta I use bem-tools + gulp + gulp-watch and I see no problem with templates' recompilation.

dfilatov commented 8 years ago

All issues about bem-tools are obsolete now.