Closed EdozdeDandez closed 5 years ago
I'm having a hard time following what is going on due to formatting. Did you restart the build after updating the build.sbt
file?
Yes I restarted it.
bild.sbt
main.scala.html with webjarutil declaration at the top
main.scala.html with webjarutil declaration just before the doctype
routes
index.scala.html
Putting the declaration at the top of the main.scala.html gives the error- not found: value main Putting the declaration just before the doctype of the main.scala.html gives the error- not found: value webJarUtil
I hope it's clear now
Oh! I see. The problem is that if you do injection into a template, then to use that template you must inject it, so in index.scala.html
do:
@this(webJarsUtil: org.webjars.play.WebJarsUtil, main: main)
For reference see: https://github.com/webjars/webjars/blob/master/app/views/index.scala.html
Thanks a lot. Will try that
Hi I'm having a problem using webjars-play on a newly created play JAVA project 2.7.3. I have changed the routes and the build.sbt files as required and downloaded it but incorporating it in the view files is a problem if I put the line at the very top of the main.scala.html page as follows: ` @this(webJarUtil: org.webjars.play.WebJarsUtil) @*
index
template. This templateString
for the title of the page and anHtml
object to insert into the body of the page. *@ @(title: String)(content: Html) <!DOCTYPE html>
@* Here's where we render the page title `String`. *@` I get the error :
_ not found: value main ` @main("Welcome to Play") {
Welcome to Play!
}
@* Here's where we render the page title `String`. *@_ If I move the webJarUtil line down as follows:
@(title: String)(content: Html) @this(webJarUtil: org.webjars.play.WebJarsUtil) <!DOCTYPE html>` I get the error:
not found: value webJarUtil
@this(webJarUtil:
org.webjars.play.WebJarsUtil) `build.sbt
name := """my-first-play-project""" organization := "com.example" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.13.0" libraryDependencies += guice libraryDependencies ++= Seq( "org.webjars" %% "webjars-play" % "2.7.3", "org.webjars" % "bootstrap" % "4.3.1" exclude("org.webjars", "jquery"), "org.webjars" % "jquery" % "3.4.1", "org.webjars" % "jquery-ui" % "1.12.1", "org.webjars" % "font-awesome" % "5.9.0", )
routes
`
Routes
This file defines all application routes (Higher priority routes first)
~~~~
An example controller showing a sample home page
GET / controllers.HomeController.index
My pages
Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
WebJars
-> /webjars webjars.Routes `
What am I doing wrong?