From 2721b55e844e6fefefee7adc0cd8d5932691d8e8 Mon Sep 17 00:00:00 2001 From: reverend Date: Sun, 17 Jan 2021 19:19:34 +0100 Subject: [PATCH] Everything, except Blocks, can be squshed --- components/00_Global/_bemGenerator.styl | 135 ++++++++++++++---------- 1 file changed, 78 insertions(+), 57 deletions(-) diff --git a/components/00_Global/_bemGenerator.styl b/components/00_Global/_bemGenerator.styl index 03e51f6..b6df258 100644 --- a/components/00_Global/_bemGenerator.styl +++ b/components/00_Global/_bemGenerator.styl @@ -134,37 +134,49 @@ render_block_modifier(modifier) } +RV-Squash() + {block} + /* * Stashing the given block under the given * name to be aliased by a late level * (See generate_aliases) */ RV-Element--name(name) - if 'RV-Element' in called-from - push(_block.alias.stash.RV-Element, { - name: name - block: block - }) - else + if 'RV-Squash' in called-from {block} + else + if 'RV-Element' in called-from + push(_block.alias.stash.RV-Element, { + name: name + block: block + }) + else + {block} RV-Element__Modifier--name(name) - if 'RV-Element__Modifier' in called-from - push(_block.alias.stash.RV-Element__Modifier, { - name: name - block: block - }) - else + if 'RV-Squash' in called-from {block} + else + if 'RV-Element__Modifier' in called-from + push(_block.alias.stash.RV-Element__Modifier, { + name: name + block: block + }) + else + {block} RV-Block__Modifier--name(name) - if 'RV-Block__Modifier' in called-from - push(_block.alias.stash.RV-Block__Modifier, { - name: name - block: block - }) - else + if 'RV-Squash' in called-from {block} + else + if 'RV-Block__Modifier' in called-from + push(_block.alias.stash.RV-Block__Modifier, { + name: name + block: block + }) + else + {block} RV-Block(block_name) @@ -181,48 +193,57 @@ RV-Block(block_name) RV-Block__Modifier(modifier_name=null) - blocks = generate_aliases(modifier_name) - modifier_name = blocks.name - blocks = blocks.blocks - push(blocks, block) - - modifier = { - name: modifier_name - blocks: blocks - elements: _block.element_stash - } - _block.element_stash = create_list() - - push(_block.block_modifiers, modifier) + if 'RV-Squash' in called-from + {block} + else + blocks = generate_aliases(modifier_name) + modifier_name = blocks.name + blocks = blocks.blocks + push(blocks, block) + + modifier = { + name: modifier_name + blocks: blocks + elements: _block.element_stash + } + _block.element_stash = create_list() + + push(_block.block_modifiers, modifier) RV-Element(element_name=null) - blocks = generate_aliases(element_name) - - element_name = blocks.name - blocks = blocks.blocks - push(blocks, block) - - element = { - name: element_name - blocks: blocks - modifiers: _block.modifier_stash - } - _block.modifier_stash = create_list() - - if is_direct_descendant_of_block() - push(_block.elements, element) + if 'RV-Squash' in called-from + {block} else - push(_block.element_stash, element) + blocks = generate_aliases(element_name) + + element_name = blocks.name + blocks = blocks.blocks + push(blocks, block) + + element = { + name: element_name + blocks: blocks + modifiers: _block.modifier_stash + } + _block.modifier_stash = create_list() + + if is_direct_descendant_of_block() + push(_block.elements, element) + else + push(_block.element_stash, element) RV-Element__Modifier(modifier_name=null) - blocks = generate_aliases(modifier_name) - modifier_name = blocks.name - blocks = blocks.blocks - push(blocks, block) - - modifier = { - name: modifier_name - blocks: blocks - } - push(_block.modifier_stash, modifier) \ No newline at end of file + if 'RV-Squash' in called-from + {block} + else + blocks = generate_aliases(modifier_name) + modifier_name = blocks.name + blocks = blocks.blocks + push(blocks, block) + + modifier = { + name: modifier_name + blocks: blocks + } + push(_block.modifier_stash, modifier) \ No newline at end of file