Filename collisions fail silently
I have an app that is using sprockets es6 to compile Javascript files. I also am using Angular Rails templates to compile HTML files to Javascript that Angular recognizes.
I'm building out UI modules with file naming conventions like so -
my-feature.es6
and
my-feature.html.slim
This results in both files compiling to my-feature.js, it's not clear to me which pre-processor will win, not that it really matters. The end result is one asset will be overwritten. I can fix this by changing my file naming conventions, but it takes time to debug a problem like this.
It would be nice if sprockets recognized it's overwriting a file it created in the same compilation event, as that's obviously an issue a developer would like to know immediately.
I agree, can you give me an example app that reproduces this behavior, I'll play around and see what options we have. This should not be a case we fail silently on.
Here's a barebones example - https://github.com/bradgreens/rails-sprockets-filename-collision.
If you fire it up, visit /my-feature in the browser. my-feature.es6 and my-feature.html.slim will compile to the same target. It demonstrates where a filename collision occurs without any notice.
Note that this is a (clearly undesirable) special case of an intended behaviour, which is that you can override a same-named asset that appears deeper in the search path.
I've not heard of that behavior, but it's your discretion if it merits a warning or whatnot.
@bradgreens I will try to pick it up 😸