Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not loading "index" templates #27

Closed
aaronchi opened this issue Apr 15, 2015 · 11 comments
Closed

Not loading "index" templates #27

aaronchi opened this issue Apr 15, 2015 · 11 comments

Comments

@aaronchi
Copy link

After upgrading to sprockets 3.0, require will no longer find or load templates named index.jst.eco

Is this intentional?

@josh
Copy link
Contributor

josh commented Apr 15, 2015

All the index stuff should still be supported.

Could you put together a failing test case or application example where it doesn't?

I'm assuming you mean

somefile/users/index.jst.eco exists and

//= require somefile/users

doesn't find it.

@vmoravec
Copy link

I stumbled upon this issue with missing all index.jst.ejs templates, in my case it was within a sinatra application. However, the index templates are being loaded fine from within a Rails app. Edited: I corrected that statement after I looked into our project Gemfile once again and we are still with sprockets 2.12 .

A failing test case can be made just by adding index.jst.ejs into the default test fixtures' path.

@josh
Copy link
Contributor

josh commented Apr 21, 2015

A failing test case can be made just by adding index.jst.ejs into the default test fixtures' path.

Can you clarify the details of this by setting up a test case. Theres a number of different ways an index.jst.ejs could be located or required.

@elia
Copy link
Contributor

elia commented Apr 21, 2015

Possibly related to #29?

@vmoravec
Copy link

The way of my thinking was this:
To me it looks like the module Sprockets::Resolve contains code that handles the index files. Among the test cases for the resolver I found one that tests the resolution of logical paths, it's this: verify all logical paths . It fails if you add an index.jst.ejs file into the fixture path. With any other filename I have used it passed. But I might have gotten it all wrong :)

This is the failure with added index.js file btw:

 1) Failure:
TestResolve#test_"verify all logical paths" [/home/vmoravec/code/sprockets/test/test_resolve.rb:242]:
Expected "..js" to resolve to /home/vmoravec/code/sprockets/test/fixtures/symlink/index.js.
--- expected
+++ actual
@@ -1 +1 @@
-"/home/vmoravec/code/sprockets/test/fixtures/symlink/index.js"
+"/home/vmoravec/code/sprockets/test/fixtures/symlink/./index.js"

@josh
Copy link
Contributor

josh commented Apr 21, 2015

It fails if you add an index.jst.ejs file into the fixture path.

index.js is one of the cases that won't pass there since it has a shorthand of omitting index.js in that case. Other shadowing examples won't pass in that set either, but thats a different issue.

@aaronchi
Copy link
Author

Similar issue reported here sstephenson#722
Seems like sprockets has some issues with how it resolves index files

@josh
Copy link
Contributor

josh commented Apr 24, 2015

@aaronchi the static case seems pretty annoying.

Maybe we should just remove that edge case entirely and leave index.js only a resolve shorthand. If you precompile, you'll always get the full path.

@tikijian
Copy link

+1

Updated our gemfile few days ago. Sprockets was changed from 2.12.3 to 3.0.1
After that all index.js.emblem files become missing. just like in sstephenson#722

@rafaelfranca
Copy link
Member

Could you check if it is fixed on master branch?

mfazekas pushed a commit to mfazekas/sprockets that referenced this issue Apr 4, 2016
@rafaelfranca
Copy link
Member

Closing since there were no activity since my last comment asking for confirmation in the master branch. Let me know if it still happens in master so I can reopen. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants