-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helper functions for jade #248
Comments
Any reason why this would need to be for Jade only? |
Not really, I guess it could be for EJS too. |
Right now about the only thing you can do is place the functions in the actual Jade (or EJS) files, or possibly use Edit |
The mixins unfortunately don't do what I'd like to do (I'd like to make a function which generates URLs, instead of hard-coding all my URLs). I've already tried just writing it inline, but its a mess. The Jade pull request sounds interesting though. I had a quick look, but couldn't find it - do you know which one it is? |
@jamesknelson pugjs/pug#1397 was what I was thinking of. Sounds like your use case might overlap with #149, though? |
I'd like to see this as well--been trying to figure out how to get a function inside the |
I am using minification to put JS on a single line in a Jade template and then include where needed: //- Underscore.js 1.6.0
//- http://underscorejs.org
//- (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//- Underscore may be freely distributed under the MIT license.
- (function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.pro ... In our templates we can include it where needed: include ../_underscore.jade
- var a = {b:1, c:2}
!= _.clone(a) It is a bit clumsy so I would love to have the ability to load JS into a Jade layout or specify it in the {
"index": {"helpers":["underscore.js"]}
} |
+1 |
1 similar comment
+1 |
I made a PR to terraform to expose lodash to templates |
I dig it. Just merged into terraform. Will likely be in next release of harp. |
So what exactly is being added - harp.hs? Or the helpers thing? |
How hard would it be to allow harp.json to actually be a harp.js, where functions can be assigned to globals, as well as standard JSON - so that helper functions could be created? Is there an existing way to get helpers in a jade template (without placing the functions in the actual jade files)?
The text was updated successfully, but these errors were encountered: