CKeditor static file can not be load in production environment
yakjuly opened this issue · 4 comments
yakjuly commented
peterberkenbosch commented
Is this stil an issue @yakjuly? If so, what version of spree and spree_editor are you using?
yakjuly commented
Spree version is 2.1.2
spree_editor version is 2.0.0
Finally, I modify my deploy.rb file to support js and css.
task :symlink_data, roles: :app do
run "mkdir -p #{shared_path}/public/spree"
run "ln -nfs #{shared_path}/public/spree #{release_path}/public/spree"
run "mkdir -p #{shared_path}/uploads"
run "ln -nfs #{shared_path}/uploads #{release_path}/uploads"
run "mkdir -p #{shared_path}/public/ckeditor_assets"
run "ln -nfs #{shared_path}/public/ckeditor_assets #{release_path}/public/ckeditor_assets"
run "mkdir -p #{shared_path}/public/sitemaps"
run "ln -nfs #{shared_path}/public/sitemaps #{release_path}/public/sitemaps"
end
It works at now.
peterberkenbosch commented
glad it worked out for you! Closing this issue then. Thanks.
yakjuly commented
Sorry, previous one is not the correct solution. Blow code is the real one.
config/deploy.rb
task :copy_nondigest_assets, roles: :app do
run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} ckeditor:copy_nondigest_assets"
end
after 'deploy:assets:precompile', 'copy_nondigest_assets'
lib/tasks/ckeditor.rake
namespace :ckeditor do
def copy_assets(regexp)
Rails.application.assets.each_logical_path(regexp) do |name, path|
asset = Rails.root.join('public', 'assets', name)
p "Copy #{path} to #{asset}"
FileUtils.mkdir_p(File.dirname(asset))
FileUtils.cp path, asset
end
end
desc 'Copy ckeditor assets, that cant be used with digest'
task copy_nondigest_assets: :environment do
copy_assets /ckeditor/
end
end