andrewdavey/cassette — Issue #140: Need an API to retrieve all referenced bundle URLs
Author: hempels
Created: 2012-01-19 22:06:32+00:00
State: open

We have an API to generate the URL for a single bundle, but that is only useful if you know the bundle paths. What I'd like to be able to do ( though I'm not certain it's possible) is generate bundle URLs for all references in a view context.

I'm using JSON to implement a Single Page Interface application. One of the things my SPI framework does is load CSS and Script dependencies dynamically along with each rendered partial view. However, what I don't have is a method to utilize the Cassette references within each view to produce the URLs for them. It would be ideal if I didn't have to make those associations outside of the views, which is what I'm doing currently.

What I've envisioned would be ideal is an API such as this:

public static class Bundles {
public static IEnumerable Urls() where T : Bundle
}

The problem I'm discovering of course is that without the context of the view, there are no present references. So here's the question - is it possible, and if so how, to retrieve a list of references for a view either before or after rendering said view and then turn those references into an IEnumerable of URLs?