Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I completely disable CoffeeScript in a Rails 3.1 app?

At the moment when I generate a new controller, Rails also generates a .js.coffee file for the controller as well. As I don't use CoffeeScript I want Rails instead generate .js files for me.

Is it enough to comment out the coffee-rails gem to completely disable CofeeScript in a Rails 3.1 app?

like image 748
K Everest Avatar asked Jan 04 '12 04:01

K Everest


People also ask

Does rails still use CoffeeScript?

CoffeeScript is no longer recommended by the Rails community.


2 Answers

  1. Comment out gem "coffee-script" in your Gemfile
  2. Use .js instead of .js.coffee for your javascript files
like image 144
Gaurav Gupta Avatar answered Oct 04 '22 00:10

Gaurav Gupta


Not sure if this counts for Rails 3.1 but in 4 you should also set the javascript_engine to :js in application.rb to instruct generators to create .js files instead of .js.coffee.

config.generators do |g|   # .. other configuration ..   g.javascript_engine :js end 
like image 22
Koen. Avatar answered Oct 04 '22 00:10

Koen.