How do I prevent Rails to enable CoffeeScript and use plain JavaScript instead?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Comment out gem 'coffee-script'
in Gemfile
回答2:
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:
Comment out
# gem "coffee-script"
in your gemfile
or just use .js vs .js.coffee files