Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

hack optimization: component.json can only be one level deep

  • Loading branch information...
commit 9a1d275a158f7e4d5de8a6d537bc312ad0057f8e 1 parent 5ac17be
@josh josh authored
View
5 lib/sprockets/asset_attributes.rb
@@ -19,7 +19,10 @@ def search_paths
path_without_extensions = extensions.inject(pathname) { |p, ext| p.sub(ext, '') }
- paths << path_without_extensions.join("component.json").to_s
+ # optimization: component.json can only be nested one level deep
+ if !path_without_extensions.to_s.index('/')
+ paths << path_without_extensions.join("component.json").to_s
+ end
if pathname.basename(extensions.join).to_s != 'index'
paths << path_without_extensions.join("index#{extensions.join}").to_s
View
4 test/test_asset_attributes.rb
@@ -2,9 +2,9 @@
class TestAssetAttributes < Sprockets::TestCase
test "search paths" do
- assert_equal ["index.js"],
+ assert_equal ["index.js", "index/component.json"],
pathname("index.js").search_paths
- assert_equal ["foo.js", "foo/index.js"],
+ assert_equal ["foo.js", "foo/component.json", "foo/index.js"],
pathname("foo.js").search_paths
assert_equal ["foo/bar.js", "foo/bar/index.js"],
pathname("foo/bar.js").search_paths
Please sign in to comment.
Something went wrong with that request. Please try again.