js.plated_output
Manage the chunks of text that are combined into a page.
This module only exposes one function, which is used to create the actual module with bound state data.
plated_output = require("./plated_output.js").create(opts,plated)
This is called automatically when the plated module is created and the return value is made available in plated.chunks note that all of these modules are bound together and operate as a group with shared data.
In the future when we talk about this module and its available functions we are referring to the return value from this create function.
js.plated_output.remember
chunks = plated_output.remember(chunks)
Remember this page, the name is expected to be found in chunks._output_filename and this is used as the key to store these chunks.
js.plated_output.remember_and_write
chunks = await plated_output.remember_and_write(chunks)
The same as remember but also instantly write out the chunks using plated_output.write
js.plated_output.write
await plated_output.write(chunks)
Write out the chunks to to _output_filename as its final page like form. chunks._output_chunkname is the name of the chunk that we intend to render into this page, eg "html"
opts.output is the directory we are going to write the file into.
If the opts.dumpjson flag is set then we also output a .json file which contains the chunks used to construct this page.
js.plated_output.write_all
plated_output.write_all()
Go through all the remembered chunks and write each one out using plated_output.write
js.plated_output.write_map
plated_output.write_map()
Output plated.map.json which is a concise map of all chunks for all files and directories.