{"repo":"gobuffalo/plush","free":true,"listed":false,"github":"https://github.com/gobuffalo/plush","clone":"git clone https://github.com/gobuffalo/plush.git","description":"The powerful template system that Go needs","language":"Go","stars":1017,"topics":["gobuffalo","templating","plush","go","golang"],"license":"MIT","category":"dev-tools","readme_excerpt":"Plush Plush is the templating system that Go both needs and deserves. Powerful, flexible, and extendable, Plush is there to make writing your templates that much easier. Introduction Video Installation Usage Plush allows for the embedding of dynamic code inside of your templates. Take the following example: Controlling Output By using the tags we tell Plush to dynamically render the inner content, in this case the string plush is great , into the template between the tags. If we were to change the example to use tags instead the inner content will be evaluated and executed, but not injected into the template: By using the tags we can create variables (and functions!) inside of templates to use later: Recursion Template functions can call themselves by name. Define the function with let name = fn(...) { ... } , then call name(...) inside the function body. This works in both the interpreter and the compiled VM renderer. renders: Recursive functions can also close over values from the surrounding template scope: The important rule is that recursive functions need a stopping condition. Without a base case, the function will keep calling itself until the render fails or a configured render budget stops it. Use let and fn ; Go-style var a = func() { ... } is not Plush syntax. Whitespace Trim Output Use when you want to render an expression and remove contiguous whitespace immediately around that tag: renders: Only spaces, tabs, \\r , and \\n directly before the opening tag and direc","default_branch":null,"files":null,"tree":[],"storefront":"/r/gobuffalo","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/gobuffalo/plush/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}