plush icon indicating copy to clipboard operation
plush copied to clipboard

Render Plush templates from Command Line

Open meson10 opened this issue 8 years ago • 3 comments

I have started using Plush in one of my project. Firstly, Good work :+1: As a part of the code pipeline, some of the Plush templates need to be validated for consistency and the output they will render.

Inspired from the erb command line tool, I have added support to plush binary to render a given template based on CLI vars or input JSON file.

Example Usage:

meson10@xps:~/workspace/plush$ cat hello.plush 
Hello, <%= name %>

meson10@xps:~/workspace/plush$ plush render hello.plush 
Hello, 

meson10@xps:~/workspace/plush$ cat test.json 
{"name": "world"}

meson10@xps:~/workspace/plush$ plush render hello.plush -c test.json 
Hello, world

meson10@xps:~/workspace/plush$ plush render hello.plush -v name=Mark
Hello, Mark

If this is of merit to your code I can send a PR. Alternatively, Please suggest if there is a better way to achieve the desired functionality.

meson10 avatar Nov 06 '17 02:11 meson10

That sounds great! I would love to see the plush binary get that.

markbates avatar Nov 06 '17 02:11 markbates

@markbates Ok cool. Sending PR.

meson10 avatar Nov 06 '17 05:11 meson10

@markbates https://github.com/gobuffalo/plush/pull/20

meson10 avatar Nov 06 '17 11:11 meson10