Reputation: 6136
Does my ruby on rails app have to use coffeeScript or could I can I Just use plain javaScript?
Upvotes: 5
Views: 4439
Reputation: 933
You need to ensure not having the same filename both in javascript and coffeescript.
For example: having both the files
assets/javascripts/application.coffee
assets/javascripts/application.js
will only get the coffeescript loaded.
Upvotes: 7
Reputation: 1580
You can also write plain JS in CoffeeScript files, just put ` around it:
hi = `function() {
return [document.title, "Hello JavaScript"].join(": ");
}`
Upvotes: 1
Reputation: 19969
Yes, you can just use Javascript. You have your files in app/assets/javascripts/*.js . On local dev, do a view source and you will see your files there.
On production, the Asset Pipeline will concatenate and minify.
Upvotes: 5
Reputation: 3083
you can write whatever you want jquery or javascript just make sure the extension for that is js
Upvotes: 0