template-mixins

Use pug mixin result as attribute value

旧街凉风 提交于 2019-12-23 22:45:45
问题 Here is a boiled-down version of what I'm trying to accomplish: mixin foo(bar) = bar + ".html" a(href= +foo("baz")) test I'd like to have the anchor tag be compiled as <a href="baz.html">test</a> , but what I'm getting instead are type errors, on foo not being a function. Although I do see that it technically isn't a function, is this not a scenario where a mixin would be useful? I've searched the pug documentation for use-case scenarios similar to mine, but without success. Is what I'm