-
Notifications
You must be signed in to change notification settings - Fork 429
Command line options
relaxed v0.1.8
Simply type in a terminal:
relaxed my_doc.pug # for documents defined in Pug, or
relaxed my_doc.html # for documents defined in HTML
The output will then be written to my_doc.pdf
. Importantly, ReLaXed runs an interactive session by default, meaning that after the first PDF generation, any change to files in the same directory will trigger a re-generation of the PDF. To simply build the document once (instead of having ReLaXed react to file changes), add --build-once
or --bo
to the command:
relaxed mydocument.pug --build-once
You can simply type relaxed
in a directory where your master .pug
document is. If the directory contains only one .pug
file, or if it contains a .pug
file named master.pug
or main.pug
this file will automatically be used for PDF generation.
# Start a session in this directory
relaxed
# Start a session in another directory with a master Pug file
relaxed path/to/directory
You can display the manual in the terminal with relaxed -h
:
Usage: relaxed <input> [output] [options]
Options:
-V, --version output the version number
--no-sandbox disable puppeteer sandboxing
-w, --watch <locations> Watch other locations (default: )
-t, --temp [location] Directory for temp file
--bo, --build-once Build once only, do not watch
-l, --locals <json> Json locals for pug rendering
-h, --help output usage information
Below are some longer descriptions of these options.
If you would like ReLaXed to react to changes in other directories (outside of the watched directory), use the --watch
option:
relaxed my_document --watch /some/other/dir /yet/another/dir
the temporary HTML file that will be printed as a PDF is saved by default under the same directory as your master document, as name_temp.htm
where name
is the name of the master document. This .htm
file is practical for troubleshooting your layout or get quick updates (as it is generally rendered quicker than the final PDF).
To have this .htm
document saved elsewhere, use --temp
or -t
:
relaxed mydoc.pug --temp /tmp/
ReLaXed accepts a --locals
argument to feed Pug variables as JSON. This is particularly useful when launching a relaxed process programmatically, for instance to generate custom PDFs on a server.
relaxed mydoc.pug --build-once --locals {"name": "Marc"}
Some environments, in particular some Docker images, will not permit Puppeteer to run with sandboxing.
Use the --no-sandboxing
options in these cases
relaxed mydoc.pug --no-sandboxing