You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the following object to your rosidfile.json, rosidfile.js or routes array. rosid-handler-ejs will transform all matching EJS files in your source folder to HTML.
optimize{?Boolean} - Optimize output. Defaults to false.
data{?Object|String} - Data used to render the template. Defaults to {}.
localOverwrites{?Boolean} - Enable or disable custom data per file. Defaults to true.
Returns
{Promise<String|Buffer>} The transformed file content.
Miscellaneous
Data
The data in opts.data will be used to render your template. opts.data can either be an object (the data) or a string (path to data file). rosid-handler-ejs tries to require the path when a string is specified instead of an object. The path must be absolute or relative to the current working directory.
Custom data per file
Create a file with the name filename.data.json or filename.data.js along your filename.ejs to add or overwrite data from opts.data. You can disable this behaviour with the localOverwrites option.
Environment
rosid-handler-ejs passes a variable called environment to your template. environment is prod when opts.optimize is true and dev when opts.optimize is false.