Question

I am using ckeditor and its not showing the icons in the toolbar. here is my setup:

application.rb

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

application.js

//= require ckeditor/override
//= require ckeditor/init

I am using Capistrano to deploy the code to the server. Here is what i am getting when I inspect a missing icon:

element.style {
background-image: url(/assets/ckeditor/plugins/icons-03589ffff0ab72dc57d667560eff4018.png);
background-position: 0 -1440px;
background-size: auto;
}
.cke_ltr .cke_button__newpage_icon {
background: url(icons.png) no-repeat 0 -1440px !important;
}

It looks like it is compiling the css correctly, when I untick this background: url(icons.png) no-repeat 0 -1440px !important; in inspector the icon works.

Any ideas would be great, really struggling to see what I am doing wrong here

Was it helpful?

Solution

Standard issue - it's to do with Rails not picking up icons.png when you're deploying to the production server. We got the icons working using the preceding tutorial:


#/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/environments/production.rb
config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
config.assets.precompile += Ckeditor.assets
config.assets.precompile += %w(ckeditor/*)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top