Extending the Comfy Client
Comfy can be modified through an extensions mechanism. To add an extension you need to:- Export
WEB_DIRECTORYfrom your Python module, - Place one or more
.jsfiles into that directory, - Use
app.registerExtensionto register your extension.
Exporting WEB_DIRECTORY
The Comfy web client can be extended by creating a subdirectory in your custom node directory, conventionally called js, and
exporting WEB_DIRECTORY - so your __init_.py will include something like:
Including .js files
Only .js files will be added to the webpage. Other resources (such as .css files) can be accessed
at extensions/custom_node_subfolder/the_file.css and added programmatically.
Registering an extension
The basic structure of an extension follows is to import the main Comfyapp object, and call app.registerExtension,
passing a dictionary that contains a unique name,
and one or more functions to be called by hooks in the Comfy code.
A complete, trivial, and annoying, extension might look like this: