From 0e85807960e97fb12c637fd3d4f4d2b61479371b Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Sat, 22 Oct 2022 13:16:54 +0300 Subject: [PATCH] Created Extensions (markdown) --- Extensions.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Extensions.md diff --git a/Extensions.md b/Extensions.md new file mode 100644 index 0000000..638a0bc --- /dev/null +++ b/Extensions.md @@ -0,0 +1,21 @@ +# Using extensions + +Extensions are a more convenient form of user scripts. + +Extensions all exist in their own subdirectory inside the `extensions` directory. You can use git to install an extension like this: + +``` +git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients extensions/aesthetic-gradients +``` + +This installs an extension from `https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients` into the `extensions/aesthetic-gradients` directory. + +# Developing extensions + +Web ui interacts with installed extensions in the following way: +- extension's scripts in the `scripts` directory are executed as if they were just usual user scripts, except: + - `sys.path` is extended to include the extension directory, so you can import anything in it without worrying + - you can use `scripts.basedir()` to get the current extension's directory (since user can name it anything he wants) +- extension's javascript files in the `javascript` directory are added to the page +- extension's `style.css` file is added to the page +