meteor-jade
meteor-jade copied to clipboard
Unable to add param to helper template method with #{ } - update docs?
I have a template helper method momentify
that accepts one argument, createdAt
The spacebars syntax works... {{ momentify createdAt }}
This syntax does not... #{ momentify createdAt }
After reading some of the other issues, you probably would say that momentify createdAt
is not a valid javascript definition, thus you don't want the jade compiler to support it, which I understand. (1) Is this correct?
However, this is not documented anywhere in your Readme. (2) For future users... I'd add a little note to the readme docs explaining this special case, since it was unclear since you mentioned you recommended using the #{ } jade syntax, thus, I figured it would be used interchangeably with the spacebars syntax.
Thanks!
(1) Correct! (2) I agree, docs need some love
Hum, after a second thought on (1), did I really say somewhere that I don't want to support this syntax? That seems a reasonable expectation assuming things like if helper arg1 arg2
work in meteor-jade. So I might add this functionality, and improve the docs anyway.
:+1: let me know the end result! Appreciate your efforts!
@mquandalle thank you for this nice package. :+1: May ask you to add explanation of this case in docs? You will save time for people who want to give a try to meteor-jade.
I'm referencing the following issues here, since I believe #98 is the first time this bug is mentioned and they all point to the same problem (my apologies if I missed one!): #113 #122 #147 #153 #157
BTW, question 1 from the OP isn't actually solved by switching from #{momentify date}
to #{momentify(date)}
. The latter just prints that exact text instead of parsing it. The only way I can make it work is switching it to its spacebars equivalent: {{momentify date}}
. HTH
There now exists a fork that seems to fix this issue: https://github.com/dalgard/meteor-jade
Yes, I've modified a fork of this package to support passing arguments to helpers, together with a few other useful features. The fork has been released as dalgard:jade
.
I will keep the new package in sync with the original, should there be any updates, and generally continue maintenance until, hopefully, the two packages can be merged.