From 4366c0f691916c869e675e83b2a8bfc778879327 Mon Sep 17 00:00:00 2001 From: marcelklehr Date: Thu, 2 Aug 2012 12:49:21 -0700 Subject: [PATCH] Updated Plugin dependencies (markdown) --- Plugin-dependencies.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Plugin-dependencies.md b/Plugin-dependencies.md index a28c4f3..36851c3 100644 --- a/Plugin-dependencies.md +++ b/Plugin-dependencies.md @@ -1,4 +1,4 @@ -As you plugins become more and more complex, you will find yourself in the need to manage dependencies between plugins. E.g. you want the hooks of a certain plugin to be executed before yours. You can manage these dependecies in your `ep.json` file: +As your plugins become more and more complex, you will find yourself in the need to manage dependencies between plugins. E.g. you want the hooks of a certain plugin to be executed before yours. You can manage these dependencies in your plugin definition file `ep.json`: ```javascript { @@ -25,10 +25,16 @@ As you plugins become more and more complex, you will find yourself in the need } ``` -The `pre`and `post` definitions, affect the order in which parts of a plugin are executed. This ensures that plugins and their hooks are executed in the correct order. +## parts +Usually a plugin will add only one functionality at a time, so it will probably only use one `part` definition to register its hooks. However, sometimes you have to put different (unrelated) functionalities into one plugin. For this you will want use parts, so other plugins can depend on them. -`pre` lists parts that must be executed *before* the defining part. `Post` lists parts that must be executed *after* the defining part. +## pre/post +The `"pre"` and `"post"` definitions, affect the order in which parts of a plugin are executed. This ensures that plugins and their hooks are executed in the correct order. + +`"pre"` lists parts that must be executed *before* the defining part. `"post"` lists parts that must be executed *after* the defining part. You can, on a basic level, think of this as double-ended dependency listing. If you have a dependency on another plugin, you can make sure it loads before yours by putting it in `"pre"`. If you are setting up things that might need to be used by a plugin later, you can ensure proper order by putting it in `"post"`. -Note that it would be far more sane to use `"pre"` in almost any case, but if you want to change config variables for another plugin, or maybe modify its environment, `"post"` could definitely be useful. Also, note that dependencies should *also* be listed in your package.json, so they can be `npm install`'d automagically when your plugin gets installed. \ No newline at end of file +Note that it would be far more sane to use `"pre"` in almost any case, but if you want to change config variables for another plugin, or maybe modify its environment, `"post"` could definitely be useful. + +Also, note that dependencies should *also* be listed in your package.json, so they can be `npm install`'d automagically when your plugin gets installed. \ No newline at end of file