Daniel Moreno
Daniel Moreno

Reputation: 15

How to get assets in play framework 2.7?

I'm trying to use AdminLTE 3 on playframework but every time I use the versioned this didn´t work.

And the content when compile is the next: <script src="Action(parser=BodyParser(ignore))"></script>.

But the code I'm using is this: <script src="@Assets.versioned("plugins/jquery/jquery.min.js")"></script>

I read at the docs Assets Overview that they said I would use Assets.at code but I can't do it works.

I apologize if my English is not very good.

EDIT:

GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)

That's my route for get the assets

name := ""
organization := ""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)

scalaVersion := "2.13.0"

libraryDependencies ++= Seq(
  javaJdbc,
  ehcache,
  javaWs,
  "com.typesafe.play" %% "play-guice" % "2.7.3",
  "org.postgresql" % "postgresql" % "9.4-1202-jdbc42"
)

routesGenerator := InjectedRoutesGenerator

And that is my build.sbt file.

Upvotes: 0

Views: 334

Answers (1)

Daniel Moreno
Daniel Moreno

Reputation: 15

Finally I found my error, I'm writting <script src="@Assets.versioned("plugins/jquery/jquery.min.js")"></script> but the correct route is script src="@routes.Assets.versioned("plugins/jquery/jquery.min.js")"></script>

Upvotes: 1

Related Questions