Closed lunelson closed 9 years ago
+1 for this feature - super useful
Thanks so much for the pull request!
I’m quite fond of this idea still, depending on what @sintaxi thinks. There’s definitely some craziness in some of the boilerplates that could be removed with this, and it’s still possible to avoid using it entirely if you don’t want to commit to making lodash/underscore a dependency for your templates.
I think we’d want to add one or two very basic tests, like we do with Autoprefixer, etc. which basically just check it’s available in the templates as expected.
Yeah I hope I did it right—it works in my testing—I've done this before with Jade in other implementations, passing lodash in to the globals
object, but it seemed to me in your code (which is very clearly structured btw) that the best place was the locals
object which also contains public
, current
etc., so I packed it in there.
Possibly the package.json
should list the lodash version more loosely though, like just 3.x
Yep, I like this. Thanks for the PR!
This PR requires lodash.js and adds it to the
locals
object passed to templates, for more powerful data manipulation in.jade
and.ejs