Improvements and reorganization of assets

This commit is contained in:
Jon Moss 2016-01-30 20:39:22 -05:00
parent 896950a605
commit 09a7060659
10 changed files with 10 additions and 3 deletions

@ -1 +1,2 @@
/lib/assets/javascripts/action_cable.js
/tmp

@ -19,10 +19,13 @@ end
namespace :assets do
desc "Compile dist/action_cable.js"
task :compile do
puts 'Compiling Action Cable assets...'
asset_mapping = { "source.js" => "action_cable.js" }
root_path = Pathname.new(dir)
load_path = root_path.join("lib/assets/javascripts/action_cable")
load_path = root_path.join("app/assets/javascripts/action_cable")
destination_path = root_path.join("lib/assets/javascripts")
compile_path = root_path.join("tmp/sprockets")
compile_path.rmtree if compile_path.exist?
@ -36,7 +39,10 @@ namespace :assets do
asset_mapping.each do |logical_path, dist_path|
fingerprint_path = manifest.assets[logical_path]
FileUtils.cp(compile_path.join(fingerprint_path), load_path.join("dist/#{dist_path}"))
FileUtils.cp(compile_path.join(fingerprint_path), destination_path.join(dist_path))
end
puts '======'
puts 'Action Cable assets compiled successfully!'
end
end

@ -0,0 +1 @@
//= require_tree ./source

@ -1 +0,0 @@
//= require ./dist/action_cable