Use dependencies to detect file type

Saves some lines. Doesn't seem to work with browserify though without requiring them outside the `forEach`.