Skip to content

Commit

Permalink
Remove asset digest in AssetPipelineProvider
Browse files Browse the repository at this point in the history
(Squashed from separate branch. Closes #34.)
  • Loading branch information
tomasc authored and Mange committed Mar 8, 2015
1 parent 97cde50 commit 17795cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/roadie/rails/asset_pipeline_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ def find_stylesheet(name)

private
def normalize_asset_name(href)
remove_asset_prefix href.split('?').first
res = remove_asset_prefix href.split('?').first
remove_asset_digest res
end

def remove_asset_digest(path)
path.gsub /-[a-z0-9]{32}\./, '.'
end

def remove_asset_prefix(path)
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/roadie/rails/asset_pipeline_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ module Rails
expect(provider.find_stylesheet("/assets/good.css?body=1")).not_to be_nil
end

it "ignores asset digest" do
pipeline.add_asset "good.css", "good.css.scss", ""
provider = AssetPipelineProvider.new(pipeline)
expect(provider.find_stylesheet("/assets/good-a1b605c3ff85456f0bf7bbbe3f59030a.css")).not_to be_nil
end

it "supports stylesheets inside subdirectories" do
pipeline.add_asset "sub/deep.css", "/path/to/sub/deep.css.scss", "body { color: green; }"
provider = AssetPipelineProvider.new(pipeline)
Expand Down

0 comments on commit 17795cf

Please sign in to comment.