usemin replace matches file in same directory

replace helper function was finding a file that ended with the same
basename. however, this wouldn't work if the file was in multiple
directories. this fix uses the dirname as well to make sure it's
the file in the same directory.