SquishIt 如何使用本地目录渲染文件,但将文件引用写入不同的子域
有没有办法使用 SquishIt 将组合文件渲染到本地目录,保留生成的文件名 SquishIt,但更改域?
所以,像这样:
Bundle.Css().Add("~/file1.css").Add("~/file2.css").Render("~/content/combined-css_#.css")
通常,SquishIt 会将其呈现为链接,用调号替换 #,如下所示:
<link rel="stylesheet" type="text/css" href="/content/combined-css_697C70D68EA1DCBE1903A58032BDB305.css" />
但是,我从静态无 cookie 域提供我的 css 和 js 文件。我希望将文件写入同一本地目录并仍然使用 SquishIt 生成的调号,但我想将样式表链接输出到:
<link rel="stylesheet" type="text/css" href="http://static.mydomain.com/content/combined-css_697C70D68EA1DCBE1903A58032BDB305.css" />
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" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您会想要使用
WithOutputBaseHref
方法。它是这样的:它对你有用吗?
I think you would want to use the
WithOutputBaseHref
method. Here is what it looks like:Does it work for you?