path.relative doesn't work as expected

When passing file paths to path.relative it generates a path that I wouldn't expect. Better to use just the dirname of the file instead.

If I have a generated folder:

```
dist
 -- img
   -- sprite.png
 -- css
   -- sprite.css
```
I would expect the image path to be ```../img/sprite.png``` and not ```../../img/sprite.png``` which is what is happening now.