Macrow / rails_kindeditor

Kindeditor for Ruby on Rails
260 stars 108 forks source link

rails 5.0.5 + rails_kindeditor (0.5.1) 在产品模式下出现default.css错误 #98

Closed jsasdw1991 closed 6 years ago

jsasdw1991 commented 6 years ago

rails 5.0.5 跟 rails_kindeditor在产品模式下出现错误:

http://xx.xx.xx.xx//assets/kindeditor/themes/default/default.css net::ERR_ABORTED

然后根据readme.md 已经执行过

  rails kindeditor:assets 

也在config/initalizers/assets.rb里边添加了

Rails.application.config.assets.precompile += %w( kindeditor/** )

用的是nginx。 然后到线上查了一下。发现访问编译后的文件是可以的。

http://xxxx.xxxx.xxxx/assets/kindeditor/themes/default/default-c22ec7839352cff0160d7cfd7378dc921a20dac1987c21b3b319d6e253b1af5c.css

想问一下这个问题怎么解决

Macrow commented 6 years ago

由于kindeditor自身的原因,没法用这个特性,所以我的做法是索性把这些文件拷贝到公共文件夹,代码如下

namespace :kindeditor do
  desc "copy kindeditor into public folder"
  task :assets do
    puts "copying kindeditor into public/assets folder ..."
    dest_path = "#{Rails.root}/public/assets"
    FileUtils.mkdir_p dest_path
    FileUtils.cp_r "#{RailsKindeditor.root_path}/vendor/assets/javascripts/kindeditor/", dest_path
  end
end

所以,看看你的问题在哪里,再排查一下。

jsasdw1991 commented 6 years ago

@Macrow 时间比较急,跟你方法差不多,也是直接拷贝。比较暴力,scp。😂