techpines/asset-rack — pull request #39 by broberson (2013-02-27 19:18:18+00:00)
Title: url replacement broken when referencing static assets (images) from inside stylus and less assets

The regular expressions being used look for single quotes around the filename within the url() css function, and stylus (at least on my machines) produces output wrapped in double quotes. Also, recreating these regular expression instances every time the Asset::create method runs is inefficient.

This patch works with either quote style, preserving whatever style was used, and moves the regexp creation to the top of the file where it only has to happen once.

CSS also allows the syntax url(/some/filename.ext), without quotes, which neither the original regexp, nor this patch, addresses. Whether that's legal syntax for less and/or stylus, I don't know.