Question

I have been trying to integrate the Ace editor to a Rails 4 project and couldn't get it to work in production.

The editor renders but -obviously enough, it can't load the mode-* files. I tried to add the whole ace tree to the compiled assets hoping it would somehow figure out it's already loaded, but it's still looking for "url/mode-html.js".

Has anyone had any luck making Ace work in Rails with precompiled assets? Am I missing something?

No correct solution

OTHER TIPS

This is the workaround I used (in my case for the worker-*.js files, but it should work for the modes and themes too):

  • create perm_assets/javascripts in /public
  • copy the .js files (e.g. worker-json.js) to public/perm_assets/javascripts
  • in one of your own .js files, add the following line (inside a document ready block):

ace.config.set("workerPath", "/perm_assets/javascripts");

Rather than (or in addition to) "workerPath", you can specify "modePath" and "themePath".

I was helped by this discussion too: https://github.com/ajaxorg/ace/issues/655

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top