简体   繁体   中英

Rails 3.1. How to prevent Rails to use CoffeScript?

How do I prevent Rails to enable CoffeeScript and use plain JavaScript instead?

Comment out gem 'coffee-script' in Gemfile

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.

Comment out # gem "coffee-script" in your gemfile or just use.js vs.js.coffee files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM