wu-wu / grunt-tt2-bem Goto Github PK
View Code? Open in Web Editor NEWTemplate Toolkit 2 to BEM bridge
Home Page: https://www.npmjs.org/package/grunt-tt2-bem
License: MIT License
Template Toolkit 2 to BEM bridge
Home Page: https://www.npmjs.org/package/grunt-tt2-bem
License: MIT License
Incorrect transition from elems
(array of strings) to elems
(array of object) for the same block and element. E.g. for sequence b-foo
, b-foo__xxx
, b-foo__zzz
, b-foo__zzz_color_red
B
{
block: 'b-foo'
}
E
{
block: 'b-foo',
elem: 'xxx'
}
E
{
block: 'b-foo',
elems: [ 'xxx', 'zzz' ]
}
E+M
{
block: 'b-foo',
elems: [
'xxx',
'zzz',
{
elem: 'zzz',
mods: [
{ mod: 'color', val: 'red' }
]
}
]
}
handleElemMod()
does not count presence of the same element as String
and checks it only as Object
. Also it does not transform previous elements.
BEM entity in include file might be pointed by tt2 expressions. At the moment it considered as invalid BEM entity and skipped.
[%~
# defaults
size = size || 'normal';
color = color || 'default';
...
%]
<[% button_tag %]
class="b-button-arrow b-button-arrow_color_[% color %] b-button-arrow_size_[% size %]"
[% IF title %]
<span class="b-button-arrow__title">[% title %]</span>
[% END %]
[% text %]
</[% button_tag %]>
It would be nice to have some mechanism to evaluate expressions such b-button-arrow_color_[% color %]
.
Template might contains a comented INCLUDE
or PROCESS
directives like
[%~ # INCLUDE 'foo.inc' %]
which should be skipped from processing. At the moment it does not.
For the boolean modifiers sometimes value stored as true
:
{
"block" : "b-foo",
"elems" : [
{
"elem" : "bar",
"mods" : [
{ "mod" : "qux", "vals" : [ true, "quux" ] }
]
}
]
}
sometimes no value:
{
"block" : "b-foo",
"elems" : [
{
"elem" : "bar",
"mods" : [
{ "mod" : "aaa" },
{ "mod" : "qux" }
]
}
]
}
Which is the right way to handle for this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.