Sanity-Check for parent block
This commit is contained in:
parent
0292e2c872
commit
4fe2c21839
@ -18,14 +18,14 @@ _get_parent_selector()
|
|||||||
* Gets the selector of the current block
|
* Gets the selector of the current block
|
||||||
*/
|
*/
|
||||||
_get_block_selector()
|
_get_block_selector()
|
||||||
return split('__', _get_parent_selector())[0]
|
return unquote(split('__', _get_parent_selector())[0])
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generates a CSS class for an
|
* Generates a CSS class for an
|
||||||
* Block according to BEM
|
* Block according to BEM
|
||||||
*/
|
*/
|
||||||
RV-Block(name)
|
RV-Block(name)
|
||||||
{_css-prefix}-{name}
|
.{_css-prefix}-{name}
|
||||||
{block}
|
{block}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -33,7 +33,7 @@ RV-Block(name)
|
|||||||
* according to BEM.
|
* according to BEM.
|
||||||
*/
|
*/
|
||||||
RV-Block__Modifier(name)
|
RV-Block__Modifier(name)
|
||||||
&{get_block_selector()}--{name}
|
&{_get_block_selector()}--{name}
|
||||||
{block}
|
{block}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -42,10 +42,9 @@ RV-Block__Modifier(name)
|
|||||||
* For more see RV-Element___Modifier
|
* For more see RV-Element___Modifier
|
||||||
*/
|
*/
|
||||||
RV-Element(name)
|
RV-Element(name)
|
||||||
block-selector = get_block_selector()
|
block-selector = _get_block_selector()
|
||||||
// Are we in a block?
|
// Are we in a block?
|
||||||
if length(block-selector) > 0
|
if block-selector != '&'
|
||||||
|
|
||||||
//Create Selector and output the CSS for the element
|
//Create Selector and output the CSS for the element
|
||||||
{block-selector}__{name}
|
{block-selector}__{name}
|
||||||
{block}
|
{block}
|
||||||
@ -62,7 +61,10 @@ RV-Element(name)
|
|||||||
name: modifier['name'],
|
name: modifier['name'],
|
||||||
modifier_block: modifier['block']
|
modifier_block: modifier['block']
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
warn('No block found. Creating One instead')
|
||||||
|
+RV-Block(name)
|
||||||
|
{block}
|
||||||
/*
|
/*
|
||||||
* Generates a CSS class for an element modifier
|
* Generates a CSS class for an element modifier
|
||||||
* according to BEM. These are ment to be part of the
|
* according to BEM. These are ment to be part of the
|
||||||
@ -74,7 +76,7 @@ RV-Element(name)
|
|||||||
*/
|
*/
|
||||||
RV-Element__Modifier(name)
|
RV-Element__Modifier(name)
|
||||||
callback = @(element, name, modifier_block){
|
callback = @(element, name, modifier_block){
|
||||||
&{get_block_selector()}__{element}--{name}{
|
&{_get_block_selector()}__{element}--{name}{
|
||||||
{modifier_block}
|
{modifier_block}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user