diff --git a/lib/jasmine/headless/files_list.rb b/lib/jasmine/headless/files_list.rb index f22414e..a92ced8 100644 --- a/lib/jasmine/headless/files_list.rb +++ b/lib/jasmine/headless/files_list.rb @@ -39,14 +39,26 @@ module Jasmine::Headless def reset! @asset_paths = nil - # register haml-sprockets if it's available... - %w{haml-sprockets}.each do |library| + # register haml-sprockets and handlebars_assets if it's available... + %w{haml-sprockets handlebars_assets}.each do |library| begin require library rescue LoadError end end + begin + require 'bundler' + + envs = [ :default ] + %w{JHW_ENV RAILS_ENV RACK_ENV RAILS_GROUPS}.each do |env| + envs << ENV[env].to_sym if ENV[env] + end + + Bundler.require(*envs) + rescue LoadError + end + # ...and unregister ones we don't want/need Sprockets.instance_eval do EXCLUDED_FORMATS.each do |extension| @@ -175,12 +187,16 @@ module Jasmine::Headless def to_html(files) alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME + p self.class.extension_filter + files.collect do |file| if alert_time && alert_time < Time.now puts "Rebuilding cache, please wait..." alert_time = nil end + p file + sprockets_environment.find_asset(file, :bundle => false).body end.compact.reject(&:empty?) end