playframework - Play framework and javascript Assets router -


i using play 2 framework scala.

i want use @routes.assets.at(...) in javascript path assets. framework not compile contents in assets directory.

is possible? or alternative?

my solution:

# in controller, scala code def jsroutergen = action {   ok(     routes.javascriptrouter("jsrouter")(      routes.javascript.assets.at // intellij tell wrong, right :)     )   ).as("text/javascript") }  # in html template # add in <head> <script src='@routes.application.jsroutergen'></script> <!-- other js needs router come after -->  # in js jsrouter.controllers.assets.at('/use/it/like/in/html/template'); 

note 2 pairs:

  • jsroutergen: defines js router code
  • jsrouter: name of router use in js code

change them like, make sure match.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -