How do I prevent Rails to enable CoffeeScript and use plain JavaScript instead?
Asked
Active
Viewed 4,982 times
17
-
3Presumably you got a good reason. Coffeescript rocks... Learning curve 0 for someone from a JS background – May 24 '11 at 14:48
3 Answers
28
Comment out gem 'coffee-script'
in Gemfile

PeterWong
- 15,951
- 9
- 59
- 68
-
9To clarify something that puzzled me (as explained in an answer to [this question](http://stackoverflow.com/questions/8722195)), the CoffeeScript gem will still get pulled into your `Gemfile.lock` if you're using other gems that require it, notably uglifier and Rails 4's Turbolinks. But commenting it out in `Gemfile` will stop the generators from creating `.js.coffee` files and they'll make `.js` files instead. – bjnord Sep 20 '13 at 00:40
19
Just name your files .js
instead of .js.coffee
. This is a Tilt naming convention. Similarly, if you don't want to use SCSS, use .css
instead of .css.scss
. Or if you'd rather use the Sass syntax with semantic whitespace, use .css.sass
.
By default, .js.coffee
files are created by certain commands (notably generate controller
) as long as gem 'coffee-script'
is in the Gemfile, so you'll want to comment that out.

Trevor Burnham
- 76,828
- 33
- 160
- 196