Answer the question
In order to leave comments, you need to log in
Why doesn't passing an object from a variable to a mixin work?
Building jade with gulp. Got a mixin
mixin test(data)
.block
.block_heading #{data.heading}
.block_text #{data.text}
+test({heading: "Heading", text: "Text"})
- var dataTest = {heading: "Heading", text: "Text"}
+test(dataTest)
events.js:85
throw er; // Unhandled 'error' event
^
TypeError: test.jade:3
1| mixin test(data)
2| .block
> 3| .block_heading #{data.heading}
4| .block_text #{data.text}
Answer the question
In order to leave comments, you need to log in
Hmm.. works for me.
mixin test(data)
.block
.block_heading #{data.heading}
.block_text #{data.text}
doctype html
html(lang="en")
head
title
body
- var dataTest = {heading: "Heading", text: "Text"}
+test(dataTest)
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
<div class="block">
<div class="block_heading">Heading</div>
<div class="block_text">Text</div>
</div>
</body>
</html>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question