Update minifier to write to build file more smartly

This handles cases where the main stylesheet is referenced from a
subdir or different directory from the root of index.html, but
still allow the minifier to write to the file using a different path
(for example outside of the webroot).