Module template can be used to extend golem module creationmechanism with your own template, so that you can be even moreproductive when building your{shiny} app.Module template functions do not aim at being called as is byusers, but to be passed as an argument to theadd_module()function.
Arguments
- name
The name of the module.
- path
The path to the R script where the module will be written.Note that this path will not be set by the user but via
add_module().- export
Should the module be exported? Default is
FALSE.- ph_ui, ph_server
Texts to insert inside the modules UI and server.For advanced use.
- ...
Arguments to be passed to the
module_templatefunction.
Details
Module template functions are a way to define your own templatefunction for module. A template function that can take the followingarguments to be passed fromadd_module():
name: the name of the module
path: the path to the file in R/
export: a TRUE/FALSE set by the
exportparam ofadd_module()
If you want your function to ignore these parameters, set... as thelast argument of your function, then these will be ignored. See the examplessection of this help.
Examples
if(interactive()){my_tmpl<-function(name,path,...){# Define a template that write to the# module filewrite(name,path)}golem::add_module(name="custom", module_template=my_tmpl)my_other_tmpl<-function(name,path,...){# Copy and paste a file from somewherefile.copy(...,path)}golem::add_module(name="custom", module_template=my_other_tmpl)}