Reputation: 2280
At the moment, I'm just individually including my javascript files. ie
<script src='@routes.Assets.at("javascript/stuff/file.js")'></script>
How would you go about including everything in a specific folder? What's the "Play! way"?
eg
<script src='@routes.Assets.at("javascript/stuff/*")'></script>
Upvotes: 2
Views: 2150
Reputation: 55798
There's no such possibility, because of simple reason: including JavaScript to HTML doc should not be done in custom order. Often just foo.js
need to be included before bar.js
and you can't force correct order using asterisk.
If you've got typical set of scripts to include in many view/layouts and don't want to traverse each view everytime when ie. version of some js changes (ie. foo.1.0.0.js
-> foo.1.2.3.js
, you can just create a tag, which you can later use in any view/layout. ie:
file: views/tags/typicalSetOfScripts.scala.html
<script src='@routes.Assets.at("foo.js")'></script>
<script src='@routes.Assets.at("bar.js")'></script>
<script src='@routes.Assets.at("etc.js")'></script>
So you will be able to use it later in any layout like:
@(title: String)(content: Html)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>@title</title>
<!-- My typical set of scripts -->
@tags.typicalSetOfScripts()
</head>
Of couurse you will need still add manually changes to the tag file.
Upvotes: 4