How to get ckeditor resources to compile and load in Rails 3.1 asset pipeline

纵饮孤独 提交于 2019-12-01 18:18:17

I've run into similar issues. I ended up using CKEditor without asset pipeline :)

After several gems tried, none worked ok in production environment. I ended up putting ckeditor into public folder of the app. That skips the asset pipeline process completely and ckeditor works just fine in production as well. No assets pre-compilation though...

Using rails 3.1, CKEditor 4.1. Although this is an old thread, maybe this could help someone...

Update: Also, if you're testing on your local production environment, don't forget to set serve_static_assets to true in config/environments/production.rb

For me it was fixed by overriding default precompile task (I used Rails 4 and CkEditor 4).

  1. Add to application.rb config.assets.precompile += ['ckeditor/*']
  2. In application.js //= require ckeditor/init
  3. Create file lib/tasks/precompile_hook.rake and paste text from this answer Precompile hook

You have a syntax error in your code. The precompile attribute is an array.

You can append a single item to the array like this:

config.assets.precompile << 'name_of_file.ext'

If your values are in an array then you have to ADD the array.

config.assets.precompile += [ /.*config\.js/, /.*en.js/, /.*editor.css/ ]

If you append then you'd have an array nested inside the precompile array, which is ignored.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!