andrewdavey / cassette

Manages .NET web application assets (scripts, css and templates)
http://getcassette.net
MIT License
536 stars 144 forks source link

Cassette with T4MVC and virtual directory #209

Closed robertbird closed 12 years ago

robertbird commented 12 years ago

Hi,

I have an issue when using cassette in conjunction with T4MVC when hosted in a virtual directory. I'd like to be able to reference my scripts and stylesheets without using paths as string and instead use the T4MVC objects.

i.e. Bundles.Reference(Links.Content.styles_css);

However when this runs in a virtual directory, T4MVC resolves to an absolute URL.

i.e. /myvirtualdir/content/styles.css

This throws a connot be found error in cassette (probably fair enough). So it's probably more of an issue with T4MVC.

But are there any ideas of how I can get these two to play nicely together?

Cheers, Rob

andrewdavey commented 12 years ago

Cassette expects paths to be application relative i.e. without the virtual directory prepended.

Can you change your T4MVC template to exclude the virtual directory from the constants?

robertbird commented 12 years ago

I appreciate this is really a problem with T4MVC and not cassette - Thanks for the response Andrew.

Just a shame, as I like the way T4MVC allows me to eliminate strings like paths in my code.

Great work with Cassette though - it's working really well for us so far!