Closed McSodbrenner closed 1 year ago
Hello, you can use attributes:
PHP-style expressions:
mixin test
p=$attributes['text']
a(href=$attributes['url'])=$attributes['link']
+test(text="Hello" link="Click me" url="https://phug-lang.com")
JS-style expressions:
mixin test
p=attributes.text
a(href=attributes.url)=attributes.link
+test(text="Hello" link="Click me" url="https://phug-lang.com")
If it does not fit your need, please provide an example of something that cannot be achieved with attributes.
It might also be possible to create a plugin for that.
It would be great if named arguments from PHP 8 (https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments) could be supported when using mixin arguments. This would extremely simplify the parameter handling of mixins with many optional parameters.