summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJean Helou <jhe@codamens.fr>2019-02-11 22:53:06 +0100
committerTobias Roeser <le.petit.fou@web.de>2019-02-14 17:45:16 +0100
commit1afcfcafe0ed45aeae52f41768797bb6ab39a4d0 (patch)
tree8e3233a3dc7dbd7bd7ae6c8c361fd21943b96889 /docs
parent4d3fc0846ad0fe8c96e274bacf00c3521e806b48 (diff)
downloadmill-1afcfcafe0ed45aeae52f41768797bb6ab39a4d0.tar.gz
mill-1afcfcafe0ed45aeae52f41768797bb6ab39a4d0.tar.bz2
mill-1afcfcafe0ed45aeae52f41768797bb6ab39a4d0.zip
Documentation section for the Play! module
Diffstat (limited to 'docs')
-rw-r--r--docs/pages/9 - Contrib Modules.md59
1 files changed, 59 insertions, 0 deletions
diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md
index b5ef8fc5..dbda9845 100644
--- a/docs/pages/9 - Contrib Modules.md
+++ b/docs/pages/9 - Contrib Modules.md
@@ -233,7 +233,66 @@ These imports will always be added to every template. You don't need to list th
#### Example
There's an [example project](https://github.com/lihaoyi/cask/tree/master/example/twirl)
+### Play Framework
+Play framework routes generation support.
+
+
+To declare a module that needs to generate Play Framework routes, you must mix-in the
+`mill.playlib.routesModule` trait when defining your module.
+
+
+```scala
+import $ivy.`com.lihaoyi::mill-contrib-playlib:0.3.3`, mill.playlib._
+object app extends RouterModule {
+// ...
+}
+```
+
+#### Configuration options
+
+ * `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 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.
+ * `def namespaceReverseRouter: Boolean = false` - Enables the namespacing of reverse routers.
+ * `def generatorType: RouteCompilerType = RouteCompilerType.InjectedGenerator` - The routes compiler type, one of RouteCompilerType.InjectedGenerator or RouteCompilerType.StaticGenerator
+
+#### Details
+
+The following filesystem layout is expected by default:
+
+```text
+build.sc
+conf/
+ routes
+```
+
+`RouterModule` adds the `compileRouter` task to the module:
+```
+mill app.compileRouter
+```
+
+(it will be automatically run whenever you compile your module)
+
+This task will compile `routes` templates into the `out/app/compileRouter/dest`
+directory. This directory must be added to the generated sources of the module to be compiled and made accessible from the rest of the code:
+```scala
+object app extends ScalaModule with RouterModule {
+ def playVersion= T{"2.7.0"}
+ def scalaVersion= T{"2.12.8"}
+}
+```
+
+To add additional imports to all of the twirl templates:
+```scala
+object app extends ScalaModule with RouterModule {
+ def playVersion = "2.7.0"
+ override def routesAdditionalImport = Seq("my.additional.stuff._", "my.other.stuff._")
+}
+```
## Thirdparty Mill Plugins