updated logic to work in gulp land, where directories are not send to pulgins and file names are not simply matched with regexp