Sha256: fb81025036ee0eedc1c061a27511d0aab8353606832479d4212523e481721966
Contents?: true
Size: 822 Bytes
Versions: 14
Compression:
Stored size: 822 Bytes
Contents
require 'fileutils' namespace "ckeditor" do desc "Create nondigest versions of all ckeditor digest assets" task "nondigest" => [:environment] do fingerprint = /\-[0-9a-f]{32,64}\./ path = File.join Rails.root.to_s, "public", Ckeditor.base_path, "**/*" files = Dir[path] for file in files next unless file =~ fingerprint nondigest = file.sub fingerprint, '.' if !File.exist?(nondigest) or File.mtime(file) > File.mtime(nondigest) FileUtils.cp file, nondigest, verbose: true, preserve: true end end end end # Based on rake task from asset_sync gem if Rake::Task.task_defined?("assets:precompile") Rake::Task["assets:precompile"].enhance do Rake::Task["ckeditor:nondigest"].invoke if defined?(Ckeditor) && Ckeditor.run_on_precompile? end end
Version data entries
14 entries across 14 versions & 4 rubygems