Skip to content

Commit

Permalink
Remove incorrect asset_path mapping
Browse files Browse the repository at this point in the history
- Including 'asset_file' (the manifest) fails if asset file is itself
  templated (erb, coffee), or if asset file uses require_self.
- Use require_self if it is necessary to include javascript inside of a
  sprockets manifest file (like application.js)
  • Loading branch information
ragaskar committed Jan 19, 2013
1 parent 63e8d46 commit be98511
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/jasmine/asset_expander.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ def expand(src_dir, src_path)
bundled_asset = @bundled_asset_factory.call(pathname, 'js')
return nil unless bundled_asset

base_asset = "#{bundled_asset.pathname.to_s.gsub(/#{src_dir}/, '')}?body=true"
bundled_asset.to_a.inject([base_asset]) do |assets, asset|
assets << "/#{@asset_path_for.call(asset).gsub(/^\//, '')}?body=true"
bundled_asset.to_a.map do |asset|
"/#{@asset_path_for.call(asset).gsub(/^\//, '')}?body=true"
end.flatten
end
end
Expand Down
3 changes: 1 addition & 2 deletions spec/asset_expander_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

expander = Jasmine::AssetExpander.new(bundled_asset_getter, asset_path_getter)
expanded_assets = expander.expand('/some_src_dir', 'asset_file')
expanded_assets.should == ['/asset_file?body=true',
'/asset1_path?body=true',
expanded_assets.should == ['/asset1_path?body=true',
'/asset2_path?body=true']
end

Expand Down

0 comments on commit be98511

Please sign in to comment.