How would SquishIt render a file using to a local directory but write the file reference to a different subdomain
Is there a way using SquishIt to render a combined file to a local directory, keeping the filename SquishIt generated, but changing the domain?
So, something like this:
Bundle.Css().Add("~/file1.css").Add("~/file2.css").Render("~/content/combined-css_#.css")
Normally, SquishIt would render that to a link, replacing the # with a key signature, as something like:
<link rel="stylesheet" type="text/css" href="/content/combi开发者_JAVA技巧ned-css_697C70D68EA1DCBE1903A58032BDB305.css" />
However, I serve my css and js file from a static cookieless domain. I want the file to be written to the same local directory and still use SquishIt's generated key signature, but I want to output the stylesheet link to:
<link rel="stylesheet" type="text/css" href="http://static.mydomain.com/content/combined-css_697C70D68EA1DCBE1903A58032BDB305.css" />
I think you would want to use the WithOutputBaseHref
method. Here is what it looks like:
Bundle.Css()
.Add("~/file1.css")
.Add("~/file2.css")
.WithOutputBaseHref("http://static.mydomain.com")
.Render("~/content/combined-css_#.css")
Does it work for you?
精彩评论