edgecase / dieter

Asset pipeline ring middleware
134 stars 22 forks source link

Nested assets aren't handled #4

Open pbiggar opened 12 years ago

pbiggar commented 12 years ago

I want to take a look at nested assets, that is for example, I have a CSS file which references an image. Have you thought of a good way to deal with this, that you can suggest?

pbiggar commented 12 years ago

Similarly, I find myself needing routes in my Haml, which are defined at the moment in noir.

jxa commented 12 years ago

So far I have not been using dieter for image assets. I have been putting them in resources/public and serving them directly, hard-coding the path in the css file. I know Rails puts images in the pipeline, but I personally have never felt the need to do so.

I'll have to think about haml routes. I see how they would be necessary. As a work-around you can use the route to the asset without the sha, i.e. <script src="/assets/data.js" Dieter will handle the redirect.

pbiggar commented 12 years ago

I want images in the pipeline so they get md5 tags and so that its clear that we shouldnt get an old cached version (especially important during a migration between views - when some front-end servers have different code than others).

The workaround will have to do for now, but it wont be good for long. I'm thinking perhaps the preprocessors could be passed a function that they could use to get an asset link, and do appropriate parsing of their inputs (eg haml's links are usually quoted, but css' are in parens, a simple regex should be workable for now).

jxa commented 12 years ago

I began spiking some code with the ultimate goal of supporting non-text assets and inter-asset linkage. Hopefully will have something to show soon-ish.