Git Product home page Git Product logo

Comments (4)

soranoba avatar soranoba commented on June 9, 2024 1

oh, I see. it sounds good.
I welcome PR.

from bbmustache.

soranoba avatar soranoba commented on June 9, 2024

ummm....
I couldn't imagine a scene where bbmustache became escript and would be useful, because I think erlang term is very difficult to pass from the command line.
The reason is the handling of single quotes and double quotes is different. 😓

bbmustache works like other mustache libraries, so mo is probably more convenient than bbmustache in this case.

Alternatively, it makes sense to create a thin escript on demand (I do this a lot).
For example, it looks like this.

$ cat <<EOF > make_cnf.escript
#!/usr/bin/env escript
%%! -pa _build/default/lib/bbmustache/ebin

main(_) ->
    Ret = bbmustache:render(<<"{{hoge}}">>, [{"hoge", 1}]),
    io:format("~p~n", [Ret]).

EOF
$ chmod +x make_cnf.escript 
$ ./make_cnf.escript 
<<"1">>

By the way, benchmark results are created by escript.
script: https://github.com/soranoba/bbmustache/blob/636815b64aecd34e3fd53e1b10d6769c6ee575d6/benchmarks/bench.escript
result: https://github.com/soranoba/bbmustache/tree/master/benchmarks

from bbmustache.

rjcoelho avatar rjcoelho commented on June 9, 2024

Both template and the erlang terms are in files. My case is I use overlay vargs I want to use to replace on template files. Eg:

#!/usr/bin/env escript
%%! -pa _build/default/lib/bbmustache/ebin

main(_) ->
    {ok, Data} = file:consult("vars.config"),
    {ok, Template}  = file:read_file("file.template)
    Ret = bbmustache:render(Template, Data),
    io:format("~p~n", [Ret]).

from bbmustache.

soranoba avatar soranoba commented on June 9, 2024

Solved by #48

from bbmustache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.