Skip to content

Commit 63eaf6d

Browse files
authored
Merge pull request #86 from tronsha/bugfix/class-for-component-on-root
Fix for include
2 parents 20d8564 + c35edf0 commit 63eaf6d

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

.github/workflows/php.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
restore-keys: |
2727
${{ runner.os }}-php-
2828
29+
- name: Composer update
30+
run: composer update
31+
2932
- name: Install dependencies
3033
if: steps.composer-cache.outputs.cache-hit != 'true'
3134
run: composer install --prefer-dist --no-progress --no-suggest

src/Compiler.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,7 @@ public function convert(): string
232232
}
233233

234234
$this->rawBlocks[] = $this->createVariableBlock();
235-
236-
if (count($this->rawBlocks)) {
237-
$html = implode("\n", $this->rawBlocks) . "\n" . $html;
238-
}
235+
$html = implode("\n", $this->rawBlocks) . "\n" . $html;
239236

240237
$html = $this->replacePlaceholders($html);
241238
$html = $this->replaceScopedPlaceholders($html);
@@ -465,10 +462,6 @@ private function preparePropertiesForInclude(array $variables, bool $isRootNode
465462
$variables[] = new Property($attribute, $value, false);
466463
}
467464

468-
if ($isRootNode) {
469-
$variables[] = new Property('dataScopedStyleAttribute', 'dataScopedStyleAttribute|default(\'\')', false);
470-
}
471-
472465
return $variables;
473466
}
474467

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{% include "/templates/ChildComponent.twig" with { 'slot_default': "", 'class': "foo" ~ " " ~ class|default(''), 'style': "color: black" ~ "; " ~ style|default(''), 'dataScopedStyleAttribute': dataScopedStyleAttribute|default('') } %}
1+
{% include "/templates/ChildComponent.twig" with { 'slot_default': "", 'class': "foo" ~ " " ~ class|default(''), 'style': "color: black" ~ "; " ~ style|default('') } %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% set text = text|default('foo') %}
22
{% set slot_default_fallback %}{{ text }}{% endset %}
33
{% set slot_default_value %}{{ slot_default|default(slot_default_fallback) }}{% endset %}
4-
{% include "/templates/ChildComponent.twig" with { 'slot_default': slot_default_value, 'class': "", 'style': "" } %}
4+
{% include "/templates/ChildComponent.twig" with { 'slot_default': slot_default_value, 'class': "" ~ " " ~ class|default(''), 'style': "" ~ "; " ~ style|default('') } %}

0 commit comments

Comments
 (0)