bem / bem-xjst

bem-xjst (eXtensible JavaScript Templates): declarative template engine for the browser and server
https://bem.github.io/bem-xjst
Other
116 stars 48 forks source link

unopinionaited generic xjst runtime #287

Closed Guria closed 8 years ago

Guria commented 8 years ago

I wonder if it's possible to extract basic runtime without bem-specific modes. xjst initially was for general purpose data transfomations. Would be great to have modern runtime implementation for other then bem-related usages.

vithar commented 8 years ago

Can you define potential users of such runtime?

Guria commented 8 years ago

From veged/xjst

For example, XJST can be used as:

  • HTTP request router
  • template engine
  • AST transformator
  • parser

Also

Also I am bit crazy on splitting of responsibilities. I think it helps codebase to be more readable and maintanable.

awinogradov commented 8 years ago

👍

qfox commented 8 years ago

That's all good but what you expect from bem-xjst? What the API you propose?

Guria commented 8 years ago

xjst: apply*, match, def, once, wrap, mode, replace, oninit bemxjst: block, elem, mod, elemMod, mix, content + above bemtree: above bemhtml: tag, cls, attrs, js + above

qfox commented 8 years ago

No, I mean we talking about JS now, what the API you await? Some example in JS would be awesome.

I know as a user of old known xjst that there are a bunch of disadvantages related to it's complexity. It's really hard to use on custom transformations in comparison to XXXtraverse + vanilla.js. And even if xjst useful for creating languages, anyway there are not so much cases for that at my POV.

Atm you just propose to split xjst logic from bem-xjst (correct me if I'm wrong) but bem-xjst by self will become slower and it is not acceptable.

But I'm not against it (since there are much pros still) if you can do it without losing performance.

miripiruni commented 8 years ago

bemtree: above

Nope. I have related question: https://github.com/bem/bem-xjst/issues/332#issuecomment-249005637

awinogradov commented 8 years ago

I need this, I want this, I like this! ;)

awinogradov commented 8 years ago

Hi there! I have made PoC of this issue. Let's discuss here #371 ;)

miripiruni commented 8 years ago

After meeting we decided to split this issue to:

  1. Use with YM, commonJS, webpack, gulp, etc.
  2. Expose API which uses require()