简体   繁体   中英

Rails and codekit - how to disable rails coffescript compilation

I'm using rails 3.2, but I'm compiling my coffee files with CodeKit.

I still want my coffee files to live inside 'assets', but each time I restart rails, it finds them in there and tries to compile them itself.

My files live in /assets/cafe/myscript.coffee, and codekit compiles them into /assets/javascripts/myscript.js

The coffee-rails gem is already commented out in my gemfile (when rails tries to (re) compile it it gives "throw Error("LoadError: no such file to load -- coffee_script)" - though I really dont want it to even try compiling.

Setting "config.assets.compile = false" in application.rb results in "application.js isn't precompiled"

you should probably just configure your sprockets manifest to not require the whole tree.

edit app/assets/javascripts/application.js

typically it looks like this:

//= require jquery
//= require jquery_ujs
//= require_tree .

change that to

//= require jquery
//= require jquery_ujs
//= require myscript

An (inferior) workaround is to put my coffeescripts inside "App" rather than "assets" (so one more branch up the tree.)

This sucks because it's not where they should go, but at least it does put it outside rails' stalker-tendencies to find coffeescript files anywhere in assets and try to compile them.

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