While just a little issue, based on the doc, I should be able to create a re-usable block. It could be my lack of Scala experience juicing me here…
I have a List of Strings that get passed to the .scala.html file. The strings are javascript file references without the “.js”.
@jsFileWithExtension(file: String) = @{
val newFile = file + ".js
}
@for(jsFile <- headJs) {
<script src="/assets/javascripts/@jsFileWithExtension("@jsFile")"></script>
}
It’s currently loading the jsFile without the extension.
Try this:
Your
jsFileWithExtensionneeds to return a value. Right now it returnsUnit. Then as Daniel pointed out the parameter to the function does not need the quote or magic@char.