These are chat archives for bem/talk

17th
Aug 2014
Alexej Yaroshevich
@zxqfox
Aug 17 2014 02:41

the purpose of noDeps originally was for canceling dependency

so it's cancelDeps :palm_tree:

Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:00
Guys. How you using your libraries in express apps?
I'm asking because I want a critical response on this https://github.com/zxqfox/express-bem
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:19
How does it fetches dependent bemhtml/bemtree files for view from desktop.bloks @zxqfox ?
@veged - is this case you mentioned as direct dependency?
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:20
It uses already built bundles.
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:21
Then you should not mention desktop.blocks under https://github.com/zxqfox/express-bem#directories, am I right?
(and it should be mentioned in readme somewhere)
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:22
More accurate only .bemhtml.js and .bemtree.js. And yes, you don't need raw blocks in production, only bundles.
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:22
(and example, how you can build those files would be nice too)
What about this package https://github.com/zxqfox/express-bemhtml ?
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:23
To build these files you just need configured project with .bem/*, declared .bemjson.js or .bemdecl.js and execute bem make
Or enb, if you using it
This package was a testing plugin with bemhtml tech only.
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:25
imho it is better to write express-bemtree and express-bemhtml
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:25
But without bemtree it's like unfinished or uncomfortable
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:26
why?
oh, i got it
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:27
Just 'cause you should pass finished bemjson tree, but in express world usually you passing some params to templates, and template renders it properly
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:28
i’m still not sure about name of the package, but nice work
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:28
May be you're right. But there are no other options. And also we must write one more plugin like express-bem-techs and arch will be too complex.
I think I should remove express-bemhtml package
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:28
why whould we?
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:30
Because express waits for name of template and some params ;-) Just like bemtree do. But not like bemhtml, and when we want ready to send html it's much harder to do it without third mixin package
which calls both bemtree and bemhtml to generate final html
It's called there "full stack"
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:32
that.engines.bemhtml.call(that, name, options ?
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:32
ye. this one
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:32
this could be params from express
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:33
ye, name (bundle name), options — all passed here by express on render call
res.render or app.render
But if we will split it on different packages
It just will have no clue
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:34
Wait a sec
Does res.render(view, [locals], callback) passing locals to options.locals
?
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:37
actually it passing to options
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:39
Hm. This is strange, need to check it ;-\ But feels like there is no difference
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:39
So in fact you have access to req and locals variable
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:39
Ye, but it's self.locals
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:39
And bemtree could store there bemjson
And bemhtml take it from there
I dont persannoly use bemhtml, but for bh logic is pretty same
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:40
It's done in complexEngine, maybe im wrong
Yup, I hope it works for bh too
It should actually, if interface the same
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:41
What i’m leading to - separate packages for bemtree and bemhtml is possible solution
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:41
mm. yes, it's possible, but much harder
Vsevolod Strukchinsky
@floatdrop
Aug 17 2014 05:41
And express-bemtree could be reused with express-bh package
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:44
Anyway you need to patch View.prototype.lookup of ExpressView object or replace it. It stores in settings.view by default. You can take it with app.get('view')
My bad I don't know how bh works and how to test it ;-(
But yes, you're right I think. It should be splitted somehow
Probably we can just append bh engine ;-\
Alexej Yaroshevich
@zxqfox
Aug 17 2014 05:50
But need to know how it works and what exactly it exports
Vladimir Grinenko
@tadatuta
Aug 17 2014 16:18
BEMHTML and BH provide the same interface — they both export apply() method which takes BEMJSON and returns HTML string. so you may provide an abstraction and use same suffix for the bundle.
this PR might be of some help for you to understand how to build BH: https://github.com/bem/bem-components/pull/434/files