AutoMin
AutoMin copied to clipboard
Assessing url() relative paths
My typical directory structure for css assets is something like /css/screen.css and /css/img/... These are root-relative paths. However, I typically do not use root-relative paths for ease of inter-environment transitions. If my css file references an image at url(img/logo.gif) that image is not going to be found in the output automin css file, because its relative directory is my automin output directory -- wherever I've decided to put it.
One obvious and easy solution would be for me to put my automin output directory inside my css/ directory, but if js is being written into it as well, I'd rather not do that structurally. I could also just use root-relative paths and be done with it, but I know many others use such relative paths when calling their css assets.
Great plugin (+module!). Hope to see more from you, Mr. Bunch.
Thanks for the kind words. So, are you asking for a feature that re-writes your relative paths in your CSS to work in the AutoMin cache directory?
That is essentially what I'm asking for, yes.
The other thing I was thinking about was this: what if I could define, as a parameter in the plugin tag, an output directory. This way I could write out my JS to where I keep all my JS files (e.g. /js) and similarly for my CSS files.
That would resolve the original issue I raised, and would also make the paths to front-end assets more semantically correct-- instead of all being served from /automin (or whatever is specified as the cache dir.)
what if I could define, as a parameter in the plugin tag, an output directory
That's a good idea. I'll get it in the next version. The key thing to note though is you'd have to make sure that whatever directory you specify is writeable. AutoMin will tell you if it's not though in the template debugger.