For Konacha, a Rails engine for testing Rails apps, we need a way to find all files that Sprockets can compile to JavaScript.
Right now we use something like
Dir['spec/javascripts/**/*_spec.*']
but this picks up .bak
, .orig
, and other backup files.
Can Sprockets tell us somehow whether it knows how to compile a file, so that backup files would be automatically excluded?
content_type_of
doesn't help:
Rails.application.assets.content_type_of('test/javascripts/foo.js.bak')
=> "application/javascript"