Anastasia
Anastasia

Reputation: 61

Play framework: Missing semicolon error in jQuery/Bootstrap JS

I'm new at Play Framework and making my first project with it. I added jQuery and bootstrap.js to my main.scala.html:

<script src="@routes.Assets.at("javascripts/jquery-2.1.3.min.js")"></script>
<script src="@routes.Assets.at("javascripts/bootstrap/bootstrap.js")"></script>

When I run my application in a browser, I get the compilation error:

Missing semicolon in \app\assets\javascripts\jquery-2.1.3.min.js:2

You can see the screenshot here: http://oi61.tinypic.com/2lllklx.jpg

The same problem if I add only a bootstrap js, minified version or separate js files.

I don't change those files, I add them in the form they were originally - downloaded from jQuery/Bootstrap websites.

I tried to add semicolons manually, but there are hundreds of them missing. I don't think that's a good idea.

Maybe I should change some settings in the Play application?

Upvotes: 3

Views: 946

Answers (1)

David
David

Reputation: 179

You put a js file on app/assets/javascript, that folder is for files that need to be compiled, like coffee script files. So, jquery and bootstrap files need to be on public/javascript.

Ensure you have a route similar to this on conf/routes:

GET   /assets/*file   controllers.Assets.at(path="/public", file)

Anyway, I recommend you to use WebJars.

Upvotes: 1

Related Questions