Closed callumlocke closed 3 years ago
require('marko/compiler')
has a compileFile
(for compiling a template for running on the server) and a compileFileForBrowser
(for compiling a template for running in the browser). You can see their usage here. If you would like more details please let us know. The compiler API is simple, but not fully documented at the moment.
Also, for reference: https://github.com/marko-js/marko/blob/master/src/compiler/index.js
a
compileFile
(for compiling a template for running on the server) and acompileFileForBrowser
(for compiling a template for running in the browser).
What is the difference between the targets? How does the target change the output?
@balupton output: "html"
compiles to template to write to an html output stream like the response object in node js.
output: "vdom"
is for use in the browser and compiles the template to render to a virtual dom which is then diffed to calculate the patches to the dom needed across renders.
You can see the difference by using the markoc
command (that ships with Marko).
# Compile a template with output "html"
markoc ./my-template.marko
# Compile a template with output "vdom"
markoc ./my-template.marko --vdom
I want to compile a required component having dependencies already compiled in in-memory variables. Is it possible to pass dependency components this way ?
https://markojs.com/docs/compiler/ (for Marko 5)
I want to compile Marko programatically, not using a CLI. Is there any documentation for this?