How to disable coffeescript on Rails 5

2019-03-12 01:32发布

问题:

Recently, I started a new rails 5.1.4 project but I've forgotten add --skip-coffee on rails new.

Is there a way to remove the coffeescript dependency without create a new project?.

Thanks in advance.

回答1:

  1. Remove or comment out gem 'coffee-rails' from Gemfile.
  2. Change Javascript files that ends with .js.coffee to .js.
  3. Add config.generators.javascript_engine = :js to your application.rb.
  4. Make sure your tmp cache is cleared with rake tmp:cache:clear