1

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/combined-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" />
Gene Reddick
  • 4,655
  • 4
  • 34
  • 35

1 Answers1

4

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?

rdumont
  • 553
  • 2
  • 6
  • 19