Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: BEMTREE landing #332

Closed
miripiruni opened this issue Aug 13, 2016 · 11 comments
Closed

Docs: BEMTREE landing #332

miripiruni opened this issue Aug 13, 2016 · 11 comments

Comments

@miripiruni
Copy link
Contributor

Цитирую обращение пользователя @tadatuta

я только что в очередной раз поймал себя на том, что с новой докой на bem-xjst некуда давать ссылку на историю про BEMTREE.

раньше была отдельная дока про BEMTREE и дока про двухуровневую шаблонизацию в целом. они были протухшие и сложные, но хоть были.

Слав, ты можешь в своей фирменной манере человекопонятного повествования написать такую? А то я пока кидаю людям вот это: https://github.com/tadatuta/bem-bemtree-static-project-stub/blob/master/README.ru.md

@miripiruni
Copy link
Contributor Author

miripiruni commented Sep 22, 2016

@tadatuta @vithar is it right that I can not use this modes in BEMTREE?

attrs()

Template:block('b').attrs()({ id: 'test' }).
Input BEMJSON: { block: 'b' }.

Expected output BEMJSON: { block: 'b', attrs: { id: 'test' } }.
Actual output BEMJSON: { block: 'b' }.

mix()

Template:block('b').mix()('mixed').
Input BEMJSON: { block: 'b' }.

Expected output BEMJSON: { block: 'b', mix: { block: 'mixed' } }.
Actual output BEMJSON: { block: 'b' }.

js()

Template:block('b').js()(true).
Input BEMJSON: { block: 'b' }.

Expected output BEMJSON: { block: 'b', js: true }.
Actual output BEMJSON: { block: 'b' }.

bem()

Template:block('b').bem()(true).
Input BEMJSON: { block: 'b' }.

Expected output BEMJSON: { block: 'b', bem: true }.
Actual output BEMJSON: { block: 'b' }.

cls()

Template:block('b').cls()('my-custom-html-class').
Input BEMJSON: { block: 'b' }.

Expected output BEMJSON: { block: 'b', cls: 'my-custom-html-class' }.
Actual output BEMJSON: { block: 'b' }.

@miripiruni
Copy link
Contributor Author

@tadatuta @vithar ping

@miripiruni
Copy link
Contributor Author

Related comment: #181 (comment)

@vithar
Copy link
Member

vithar commented Oct 4, 2016

I think we can add these mods to bemtree.

@miripiruni
Copy link
Contributor Author

Good

@tadatuta
Copy link
Member

tadatuta commented Oct 4, 2016

Oh, I lost this issue for some reason.

It was done on purpose: BEMTREE is just about data and these mods are about HTML output. All these fiels can be easily set in parent.
So I vote against it:

  1. It will make BEMTREE slower
  2. It will be even harder for users to decide which template to choose

@miripiruni
Copy link
Contributor Author

@tadatuta but how I can write templates where I need to add mix or attrs to BEMJSON?

@tadatuta
Copy link
Member

tadatuta commented Oct 5, 2016

обычно у тебя есть корневой блок — точка входа, который кладет в себя новые блоки, а те, в свою очередь, своих чайлдов и так далее.
и вот каждый раз, когда ты создаешь чайлдов, можно указывать не только их имя, модификаторы и нужные им данные, но и миксы с атрибутами.
вообще, в большинстве случаев сам блок не должен отвечать за миксы с другими сущностями. это задача родителя, который знает, что вот этот импут — не только блок input, но еще и элемент формы. если только эти миксы не про оформление (типа смиксовать с clearfix), но такому место в BEMHTML, как, собственно, и атрибутам.
да, есть редкие кейсы, когда это оправдано, но в этом случае пользователь сможет сделать this.extendCtx({ mix: 'b2' }).

@miripiruni
Copy link
Contributor Author

@tadatuta this.extendCtx() сейчас не существует…

@miripiruni
Copy link
Contributor Author

@tadatuta хорошо, давайте на встрече голосом этот решим по этой задаче.

@miripiruni
Copy link
Contributor Author

Closed in favor of #362

miripiruni added a commit that referenced this issue Nov 10, 2016
For motivation see #362 Spoiler: we want have no difference in modes with BEMTREE and
BEMHTML, only output format difference (BEMJSON for BEMTREE, HTML for BEMHTML).

Fixed: #362
See also: #332
miripiruni added a commit that referenced this issue Nov 10, 2016
For motivation see #362 Spoiler: we want have no difference in modes with
BEMTREE and BEMHTML, only output format difference (BEMJSON for BEMTREE,
HTML for BEMHTML).

Fixed: #362
See also: #332
miripiruni added a commit that referenced this issue Nov 10, 2016
For motivation see #362 Spoiler: we want have no difference in modes with
BEMTREE and BEMHTML, only output format difference (BEMJSON for BEMTREE,
HTML for BEMHTML).

Fixed: #362
See also: #332
miripiruni added a commit that referenced this issue Nov 10, 2016
For motivation see #362 Spoiler: we want have no difference in modes with
BEMTREE and BEMHTML, only output format difference (BEMJSON for BEMTREE,
HTML for BEMHTML).

Fixed: #362
See also: #332
@miripiruni miripiruni added this to the 8.5.0 milestone Dec 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants