diff --git a/site/content/index.md b/site/content/index.md index 25bfe14a..ac0f860a 100644 --- a/site/content/index.md +++ b/site/content/index.md @@ -89,6 +89,13 @@ func Build() error { Run the above `Build` target by simply running `mage build` in the same directory as the magefile. +## Magefiles directory + +If you create your Magefile or files within a directory named `magefiles` And there is no Magefile in your current directory, +`mage` will default to the directory as the source for your targets while keeping the current directory as working one. + +The result is the equivalent of running `mage -d magefiles -w .` + ## Demo {{< youtube Hoga60EF_1U >}} diff --git a/site/content/magefiles/_index.en.md b/site/content/magefiles/_index.en.md index 6f908172..dcfb4bda 100644 --- a/site/content/magefiles/_index.en.md +++ b/site/content/magefiles/_index.en.md @@ -89,3 +89,17 @@ mage target: The first sentence in the comment will be the short help text shown with mage -l. The rest of the comment is long help text that will be shown with mage -h ``` + +### Magefiles directory + +Some development IDEs might work erratically with magefiles sharing location with other go files which very well might +have a different package name. + +To simplify development, if you place your Magefiles inside a `magefiles` directory, and none remains in your +main folder, the `mage` command will pick the directory as the source of your targets while keeping the current directory +as the working one. + +The `magefiles` directory does not require for you to add build tags to the files in it, it is optional, however we +encourage you to keep it consistent, either all or none. + +Effectively this is the equivalent of running: `mage -d magefiles -w .` \ No newline at end of file