I would like to be able to pass an object with key / value pairs that represent the attributes for the element. Is this possible with Jade?
Any solution that allows me to pass a collection of attributes into my template would be sufficient, but it would be ideal to combine explicitly declared attributes with attributes retrieved from the object (as shown below).
The following syntax does not work, this is just an example of what I would like to do.
For example, if I passed this:
{ name:'username', value:'bob', attributes: { maxlength: 16 } }
To this template:
input(name=name, value=value, attributes)
Desired Result:
<input name="username" value="bob" maxlength="16" />
Prestaul
source share