Rails 3.1. How to prevent Rails to use CoffeScript

2019-01-24 01:33发布

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

3条回答
【Aperson】
2楼-- · 2019-01-24 02:16

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.

查看更多
等我变得足够好
3楼-- · 2019-01-24 02:19

Comment out gem 'coffee-script' in Gemfile

查看更多
可以哭但决不认输i
4楼-- · 2019-01-24 02:19

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

查看更多
登录 后发表回答