Customize CSS image path for dev and production environments

I am currently developing a website and I have a local environment hosted on an XP box with IIS 5.1. I am using ASP MVC2 and .NET Framework 4.0.

What I want to know is if there is a way to "configure" in web.config (or in any other way) the path for all my images so that when using my CSS url () it automatically knows where to look.

The main reason for this is that we have many images and documents that we do not want to store in our original control, since they have nothing to do with their presence, as they vary greatly from our content authors.

Providing the developer and prod space for editing, viewing and deploying their own documents is also a huge performance benefit, and I want to keep it that way, if possible, since we have a mechanism to check that all files on our sites are valid.

So, for example, in my dev block I would like to use " http: //static.devserver/Images/ ...", but when deployed, I would like them to use " http: //static.productionserver/Images / ... "

Obviously, given my requirements above, placing CSS in a static subdomain will not work in this scenario, or maybe I missed something?

mod_rewrite / htaccess, , , .

, , , , , , .

!

+5
4

, . , .css , URL ( CSS.

? ? url ('/css/yourcss.css) dev, .

(, , cookie, WAAAY )

0

BarMonster - . URL ('/subfolder/yourfile.ext'). , .

0

, , ! , , url, ! "" "" URL-!

!

Rewriter URL- Intelligencia :

<rewriter>
        <redirect url="^.+\.(?:jpg|bmp|png|gif)$" to="http://myDEVserver$0" processing="stop" />
</rewriter>
0

, , google, , , .

- CSS , url() .

Razor MVC 3, URL. MVC- URL- . , .

<style type="text/css">
    .back
    {
        background: url(@Url.Content("~/Content/icons/gray/back.png")) no-repeat;
    }
    .link
    {
        background: url(@Url.Content("~/Content/icons/gray/link.png")) no-repeat;
    }
</style>

Razor, MVC 2 MasterPage.

0

All Articles