remy/inliner — pull request #12 by samstewart (2011-12-20 21:29:47+00:00)
Title: @import support for arbitrarily nested files

Remy,
I'm an iOS developer who works for playhaven and we use your tool to inline some of our proprietary templates. Recently, my colleague noticed some problems with nested @imports. Namely, the the "url(..)"s were not being resolved correct (encoded and inlined).

After working with the code extensively, I found the problem in the getImportsCSS method. Basically, the original "flat substitution" method was problematic because the code must resolve the "url(...)" references *relative* to the @imported file just as the browser does. Hence, pinning the _rooturl_ parameter at the topmost level was causing the problems.

Anyway, this is a rough first draft so please feel free to have me change anything. I tried to change as little as possible to stay inline (no pun intended) with the original codebase.

Best,
Sam