Kinda support manifest.compile with simple path #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Theres been a few issues around
Manifest#compile
targeting assets using transformers.The issue has to do with how 2.x and 3.x implement
manifest.compile
. To support arbitrary procs and fnmatch syntax, sprockets has to iterate over every darn file in the load path to check it against these filters. Its terribly slow. It also works on full path names rather than logical path names. Somanifest.compile "application.js"
isn't the same asfind_asset("application.js")
, even though it mostly acts the same. The other times causes these reported bugs.On 4.x, I removed all the compile magic and made
manifest.compile "application.js"
just dofind_asset("application.js")
. Its much simpler and faster but means you can't do this fnmatch stuff anymore.For 3.x I was just leaving things how they worked on 2.x cause I couldn't really figure out how to still support the 2.x behavior without it. But, I think we can maybe detect if a path passed to
compile
is "simple" and doesn't use any fnmatch magic and we can just do a direct lookup. I feel like theres some other gotcha to this, but I think it might fix most the causing issues people are actually hitting.Again, this hacks don't need to stick around in 4.x, this code path is basically deleted. This test case was actually cherry picked from the 4.x branch cause it already works there.
/cc @tricknotes @praxxis @rafaelfranca @lucasmazza