2
我想將我的靜態內容移動到CDN。但我喜歡(愛?)T4MVC,並希望繼續使用它。所以理想情況下,我想在生產「http:// mysite」中替換爲「http:// cdnaddress/path」。有人試過嗎?會有什麼陷阱嗎?T4MVC通過CDN
我想將我的靜態內容移動到CDN。但我喜歡(愛?)T4MVC,並希望繼續使用它。所以理想情況下,我想在生產「http:// mysite」中替換爲「http:// cdnaddress/path」。有人試過嗎?會有什麼陷阱嗎?T4MVC通過CDN
查找ProcessVirtualPathDefault在T4MVC.tt.settings.t4:
// You can change the ProcessVirtualPath method to modify the path that gets returned to the client.
// e.g. you can prepend a domain, or append a query string:
// return "http://localhost" + path + "?foo=bar";
private static string ProcessVirtualPathDefault(string virtualPath) {
// The path that comes in starts with ~/ and must first be made absolute
string path = VirtualPathUtility.ToAbsolute(virtualPath);
// Add your own modifications here before returning the path
return path;
}
您應該能夠通過調整這一代碼來實現你想要什麼。
t4mvc與此無關。 –
@Daniel,真的嗎? T4MVC生成我的「強類型」靜態鏈接 – SiberianGuy