I'm new to play framework and I'm trying to separate my app into multiple, smaller modules. For instance, I want to have a header module and a sidebar module.
For now, I've created these modules and a page module, that will render each module into its right place.
Here's an example of a module code:
package controllers
import play.api.templates._
object SidebarService {
def getHTML() : Html = {
views.html.sidebar(name = "variable", repeat = 5)
}
}
Note that it is returning an Html object.
And here's an example of a page module
package controllers
import play.api._
import play.api.mvc._
object Application extends Controller {
def index = Action {
var sideBar = SidebarService.getHTML()
Ok(views.html.index(sideBar)("Your new application is ready."))
}
}
This works fine, but I'm a little bit confused on how to get module-specific Assets to be included in page module, e.g. sidebar module has specific css and javascript files that will be "included" (and minified) in the <head> tag of page module. First, am I going in the right direction for modularization? Secondly, how could I accomplish module-specific assets?
Any pointers would be great.