Can you create a node that just has a template in it?

I was wondering whether there is a possibility where I can create a bunch of node-RED nodes to distribute for my app, which in essence just contains certain templates for YAML files.

The idea is to let the user configure the nodes through the editor UI and the custom nodes then file the information out and spew the YAML output to a dedicated file in a directory.

Are the some examples I can look into to achieve this?

Or is it better to create subflows and package them as nodes in this case ?

Why let users any where near the editor.
You could set up custom forms for user input. These forms could then be used to create YAML files.

simple example.

[{"id":"330cbeb17327e168","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"{\"xmas\":false,\"hens\":2,\"birds\":\"Sparrow\\nShrike\"}","payloadType":"json","x":110,"y":2220,"wires":[["18d8063eeda366fb"]]},{"id":"18d8063eeda366fb","type":"junction","z":"65617ffeb779f51c","x":220,"y":2220,"wires":[["d347426887b4c362"]]},{"id":"d347426887b4c362","type":"ui_form","z":"65617ffeb779f51c","name":"","label":"","group":"2d4fe667.28f8ba","order":19,"width":0,"height":0,"options":[{"label":"xmas","value":"xmas","type":"checkbox","required":true,"rows":null},{"label":"hens","value":"hens","type":"number","required":true,"rows":null},{"label":"birds","value":"birds","type":"multiline","required":true,"rows":3}],"formValue":{"xmas":false,"hens":"","birds":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":310,"y":2220,"wires":[["4b56eac8f66ce123","18d8063eeda366fb"]]},{"id":"4b56eac8f66ce123","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"set","p":"payload.birds","pt":"msg","to":"$split($$.payload.birds, \"\\n\")[$!=\"\"]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":2220,"wires":[["4808d95246bd7868"]]},{"id":"4808d95246bd7868","type":"template","z":"65617ffeb779f51c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"---\n xmas: {{{payload.xmas}}}\n french-hens: {{{payload.hens}}}\n calling-birds:\n   {{#payload.birds}}\n   - {{.}}\n   {{/payload.birds}}","output":"str","x":680,"y":2220,"wires":[["f7fafa6366915278"]]},{"id":"f7fafa6366915278","type":"debug","z":"65617ffeb779f51c","name":"file node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":2280,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.