Skip to content

Commit 1cb7b0e

Browse files
committed
Document parameters passing
1 parent 18aea1e commit 1cb7b0e

3 files changed

Lines changed: 42 additions & 1 deletion

File tree

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,42 @@ My page content
9191
Custom footer
9292
</footer>
9393
```
94+
95+
### Parameters
96+
97+
Component inherit mixin behavior.
98+
99+
Parameters can be passed as in mixins:
100+
101+
```pug
102+
component page($title)
103+
header
104+
h1=$title
105+
106+
slot
107+
108+
footer
109+
slot footer
110+
| Footer of #{$title} page
111+
112+
+page("Contact")
113+
| Contact us
114+
```
115+
116+
(`$title` becomes `title` if you use pug-php or js-phpize)
117+
118+
Output:
119+
120+
```html
121+
<header>
122+
<h1>
123+
Contact
124+
</h1>
125+
</header>
126+
127+
Contact us
128+
129+
<footer>
130+
Footer of Contact page
131+
</footer>
132+
```

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"prefer-stable": true,
2323
"require": {
2424
"php": ">=7.2",
25-
"phug/phug": "dev-feature/configurable-scanners as 1.5.0"
25+
"phug/phug": "^1.5"
2626
},
2727
"require-dev": {
2828
"phpunit/phpunit": "^8.5",

tests/Phug/Component/ComponentExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ public function testBasicMixinAreStillFine()
326326
}
327327

328328
/**
329+
* @covers ::__construct
330+
* @covers ::getOptions
329331
* @covers ::enable
330332
*
331333
* @throws PhugException

0 commit comments

Comments
 (0)