Add support for registering custom merge (mustache) functions

  • 4
  • Idea
  • Updated 2 years ago
Currently, Skuid provides support in merge syntax for things like $Model, $Label, etc. as well as some stock functions like en/decodeUrl.  

Would like to see support added for registering custom merge/mustache properties and functions.

Examples:
1) register $MyAppInfo which is an in-memory object
Usage: {{$MyAppInfo.myProperty}}
2) register currentTime which would be a function to automatically merge in the current time
Usage: {{#currentTime}}The time is: {{/currentTime}}
3) register doSomethingCool which would be a function to automatically merge in something cool
Usage: {{#doSomethingCool}}{{MyField__c}}{{/doSomethingCool}}

Thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb

Posted 3 years ago

  • 4
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
That would be neat! Vote this up if you'd like to see it so the devs know how important this is as they consider ideas for future releases.

Thanks!
Amy
Photo of mB Andréas K.LeF

mB Andréas K.LeF

  • 1,244 Points 1k badge 2x thumb
I want this so badly. I had an extremely simple use case involving some template logic that I would have loved to have this functionality for.

I believe the way mustache is currently loaded on the page could (with a few simple changes) allow custom functions to be defined, but the parsing of template contents has to make the call to the custom (lambda) function...

Specifically, what I want defined is Lambda expressions as explained here (further down) on the mustache docs.
(Edited)