Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEditor with Bootstrap Skin precompile issue in Production for Rails 4

I am trying to use the bootstrap skin for ckeditor in rails 4. All works fine in development but I get a precompile error in production.

I added ckeditor gem (https://github.com/galetahub/ckeditor). Then downloaded the bootstrap skin from (https://github.com/Kunstmaan/BootstrapCK4-Skin/tree/master/skins/bootstrapck)

I added the skin content in vendor/assests/javascript/ckeditor/skins

and added ckeditor to precompile array. Rails.application.config.assets.precompile += %w( ckeditor/* )

In precompiling assets I get Sass::SyntaxError: Undefined variable error.

There are some scss files in the skin folder like vendor/assets/javascripts/ckeditor/skins/bootstrapck/scss/components/_colorpanel.scss that have variables for example in above mentioned file there variable for colors like $gray (from bootstrap I suppose).

I think the scss files in the vendor folder cant access the variables and other scss from app/assets in precompile task.

Any idea how can I fix this, or is this actually the correct way of adding the extra skin in vendor folder?

rails 4.1.4 sass-rails 4.0.4 ckeditor 4.1.1

appreciate any help.

like image 381
tina nazarian Avatar asked Jan 12 '15 13:01

tina nazarian


1 Answers

You can add

@import "../config/config";

at the top of most partials in

vendor/assets/javascripts/ckeditor/skins/bootstrapck/scss/components/

and

@import "colors";

at the top of

vendor/assets/javascripts/ckeditor/skins/bootstrapck/scss/config/_defaults.scss

to make it work.

It's not very DRY, but at least the skin assets will precompile.

like image 76
Tiago Avatar answered Nov 15 '22 09:11

Tiago