CKeditor gem 生产模式问题

2024-04-08

我正在使用CKEditor 宝石 https://github.com/galetahub/ckeditor。我的配置为application.js and routes.rb如下:

# application.js
//= require ckeditor/init

# routes.rb
mount Ckeditor::Engine => '/ckeditor'

gem 在开发模式下工作正常,但是当转移到生产模式时,当浏览器请求 ckeditor 文件夹中的 js 和 css 文件时,我收到错误 404:

GET http://mydomain/assets/ckeditor/config.js?t=D2LI 404 (Not Found)
GET http://mydomain/assets/ckeditor/skins/moono/editor.css?t=D2LI 404 (Not Found)
GET http://mydomain/assets/ckeditor/lang/vi.js?t=D2LI 404 (Not Found)
GET http://mydomain/assets/ckeditor/styles.js?t=D2LI 404 (Not Found) 

请帮助我修复我的 ckeditor 路由配置。先感谢您。


您需要明确指示 Rails 在生产环境中预编译 CKEditor 资源:

# config/application.rb
config.assets.precompile += Ckeditor.assets

然后,在您的生产环境中,强制预编译:

rake assets:precompile:all
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

CKeditor gem 生产模式问题 的相关文章

随机推荐