lib/classy_assets.rb in classy_assets-0.0.5 vs lib/classy_assets.rb in classy_assets-0.1.0

- old
+ new

@@ -13,16 +13,16 @@ def self.asset_digest=(digest) @asset_digest = digest end - def self.asset_dirs - @asset_dirs ||= %w(fonts images javascripts stylesheets) + def self.asset_paths + @asset_paths ||= build_asset_path(%w(fonts images javascripts stylesheets)) end - def self.asset_dirs=(dirs) - @asset_dirs = dirs + def self.asset_paths=(paths) + @asset_paths = paths.to_a end def self.asset_host @asset_host ||= nil end @@ -77,15 +77,19 @@ def self.root_path=(path) @root_path = path end + def self.build_asset_path(dir_names) + dir_names.map! do |dir_name| + File.join(root_path, asset_prefix, dir_name) + end + dir_names + end + def self.sprockets @sprockets ||= Sprockets::Environment.new(root_path) - asset_dirs.each do |asset_dir| - _path = File.join(root_path, asset_prefix, asset_dir) - @sprockets.append_path _path - end + asset_paths.each { |asset_path| @sprockets.append_path asset_path } @sprockets end end end