Can we just use file.endswith('.js') here? May be simpler than regex.