zoukankan      html  css  js  c++  java
  • ruby -- 进阶学习(十三)解说ckeditor在production环境下如何完整显示

    将ROR项目从development环境改为production环境时,运行rake assets:precompile后,

    ckeditor的界面就无法完整显示?! @_@??

    出现 ActionController::RoutingError (No route matches [GET] "/assets/ckeditor/config.js")

    solution :creating a rake task that couples with "assets:precompile" to create "non-digested" versions of the ckeditor asset files after pushing to production,and made a /lib/tasks/ckeditor.rake file with the following task.

    就是说在 /lib/tasks目录下创建个新的文件ckeditor.rake,在该文件中添加下面代码:

    # lib/tasks/ckeditor.rake
    require 'fileutils'
    desc "Create nondigest versions of all ckeditor digest assets"
    task "assets:precompile" do
      fingerprint = /-[0-9a-f]{32}./
      for file in Dir["public/assets/ckeditor/**/*"]
        next unless file =~ fingerprint
        nondigest = file.sub fingerprint, '.'
        FileUtils.cp file, nondigest, verbose: true
      end
    end

    然后在 /config/application.rb中添加下面代码:

    config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
    config.assets.precompile += Ckeditor.assets
    config.assets.precompile += %w(ckeditor/*)

    接着在 /app/assets/javascripts/application.js中添加:

    //= require ckeditor/ckeditor

    在 /config/route.rb 中,

    mount Ckeditor::Engine => '/ckeditor'

     重新运行 rake assets:precompile

     这样ckeditor的界面就能完整显示啦!!

     @_@!! over~~

     附:参考链接:https://github.com/galetahub/ckeditor/issues/307

  • 相关阅读:
    stl_heap.h
    stl_tree.h
    stl_set.h
    stl_multiset.h
    ant:如何用ant将web project打包成war包
    将java project打包成jar包,web project 打包成war包的几种演示
    windows的各种扩展名详解
    图解教你如何使用ANT打包java程序
    使用apache mail发送邮件错误解决办法
    java虚拟机的运行原理
  • 原文地址:https://www.cnblogs.com/lmei/p/3306643.html
Copyright © 2011-2022 走看看