First time with Marko

30 views
Skip to first unread message

Gilson DElrei

unread,
Aug 4, 2015, 10:40:30 PM8/4/15
to RaptorJS
Hello all.
I installed Marko package according to the documentation . It was installed in a folder \ nodejs \ node_modules \ marko . I tried to follow the documentation and have compiled the hello.marko and here begin the doubt. I do not know exactly what to do from here. Based on http://raptorjs.org/marko/try-online/#Simple_Hello_World I create an .html file simply ? No include required ? Please can provide a more complete example of html + JS ?

Thanks in advance .

Gilson

Phil Gates-Idem

unread,
Aug 4, 2015, 10:51:30 PM8/4/15
to rapt...@googlegroups.com
Gilson,

A marko file needs to be rendered to produce output. Typically the output is HTML. A common use case is to render a template out to a file or out to an HTTP response.

First check out how to load a template:

Next, take a look at the Streaming API:

This section shows how to render a template to a "index.html" file.

An HTTP response object is also a stream this code is also common:
require('./my-template.marko').render({a: '123'}, res);

The {a: '123'} argument is just data that becomes available in the template via the "data" variable.

For example, to render the value of the "a" property in your template use:
${data.a}

You can also bundle up compiled templates and use these templates to render data in the browser. My guess is that you're starting with server-side rendering but client-side rendering of a template is also really powerful.

Let me know if I can help with anything else!

Thanks,
Phil

--
You received this message because you are subscribed to the Google Groups "RaptorJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raptorjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages