Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 419
Anastasia Avatar asked Feb 04 '26 20:02

Anastasia


1 Answers

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.

like image 187
David Avatar answered Feb 06 '26 09:02

David



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!