summaryrefslogtreecommitdiff
path: root/docs/pages/9 - Contrib Modules.md
diff options
context:
space:
mode:
authorJean Helou <jhe@codamens.fr>2019-02-14 14:49:08 +0100
committerTobias Roeser <le.petit.fou@web.de>2019-02-14 17:45:16 +0100
commitb553dfc027a9977f4a5fd802e419181e5a6f3b61 (patch)
tree53e9cbc4386d388c5870849f91feee9036029fc9 /docs/pages/9 - Contrib Modules.md
parent15ef8e7cd52930f1591ab7a88081fc80468fed85 (diff)
downloadmill-b553dfc027a9977f4a5fd802e419181e5a6f3b61.tar.gz
mill-b553dfc027a9977f4a5fd802e419181e5a6f3b61.tar.bz2
mill-b553dfc027a9977f4a5fd802e419181e5a6f3b61.zip
better aligns RouterModule with mill's naming conventions
Diffstat (limited to 'docs/pages/9 - Contrib Modules.md')
-rw-r--r--docs/pages/9 - Contrib Modules.md31
1 files changed, 26 insertions, 5 deletions
diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md
index dbda9845..5524c23a 100644
--- a/docs/pages/9 - Contrib Modules.md
+++ b/docs/pages/9 - Contrib Modules.md
@@ -253,7 +253,7 @@ object app extends RouterModule {
* `def playVersion: T[String]` (mandatory) - The version of play to use to compile the routes file.
* `def scalaVersion: T[String]` - The scalaVersion in use in your project.
- * `def routesFile: T[PathRef]` - The path to the main routes file. (Defaults to the standard play path : `conf/routes`.)
+ * `def conf: Sources` - The directory which contains your route files. (Defaults to : `routes/` )
* `def routesAdditionalImport: Seq[String]` - Additional imports to use in the generated routers. (Defaults to `Seq("controllers.Assets.Asset", "play.libs.F")`
* `def generateForwardsRouter: Boolean = true` - Enables the forward router generation.
* `def generateReverseRouter: Boolean = true` - Enables the reverse router generation.
@@ -265,9 +265,11 @@ object app extends RouterModule {
The following filesystem layout is expected by default:
```text
-build.sc
-conf/
- routes
+.
+├── app
+│   └── routes
+│   └── routes
+└── build.sc
```
`RouterModule` adds the `compileRouter` task to the module:
@@ -286,7 +288,7 @@ object app extends ScalaModule with RouterModule {
}
```
-To add additional imports to all of the twirl templates:
+To add additional imports to all of the routes:
```scala
object app extends ScalaModule with RouterModule {
def playVersion = "2.7.0"
@@ -294,6 +296,25 @@ object app extends ScalaModule with RouterModule {
}
```
+If you want to use playframework's default of storing the routes in `conf/` you can do the
+follwing:
+```scala
+object app extends ScalaModule with RouterModule {
+ def playVersion = "2.7.0"
+ override def routesAdditionalImport = Seq("my.additional.stuff._", "my.other.stuff._")
+ override def routes = T.sources{ millSourcePath / 'conf }
+}
+```
+
+which will work with the following directory structure:
+```text
+.
+├── app
+│   └── conf
+│   └── routes
+└── build.sc
+```
+
## Thirdparty Mill Plugins
### DGraph