Ckeditor宝石问题与生产模式

Ckeditor宝石问题与生产模式

本文介绍了Ckeditor宝石问题与生产模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用。我的 application.js 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(找不到)
GET http://mydomain/assets/ckeditor/skins/moono/editor.css?t = D2LI 404(找不到)
GET http ://mydomain/assets/ckeditor/lang/vi.js?t = D2LI 404(找不到)
GET http://mydomain/assets/ckeditor/styles.js?t = D2LI 404(找不到)

请帮助我修复我的ckeditor路由配置。提前感谢。

解决方案

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

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



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

  rake assets:precompile:all 


I'm using the CKEditor gem. My config for application.js and routes.rb are like the followings:

# application.js
//= require ckeditor/init

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

The gem works fine in development mode, but when moving to the production mode, I got the error 404 when browsers request the js and css files in ckeditor folder:

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)

Please help me to fix my ckeditor route config. Thank you in advance.

解决方案

You'll need to explicitly direct Rails to precompile your CKEditor assets in production:

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

Then, within your production environment, force a precompilation:

rake assets:precompile:all

这篇关于Ckeditor宝石问题与生产模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 01:04