Is there some way to intercept and modify the html output stream in asp.net, to combine the javascript?
Is there some way to intercept the HTML output stream in asp.net and make modifications? Eg using httpmodules or something? I know this is possible using java servlets and assume there must be an elegant way to do this with asp.net.
My purpose is to combine the many javascript files into one composite script which has been minified/packed, to make the page load faster.
Eg, if my page normally outputs the following in the page head:
<script type="text/javascript" src="/scripts/blah.js"></script>
<script type="text/javascript" src="/scripts/yada.js"></script>
I want to replace that with the following:
<script type="text/javascript" src="/scripts/all.js"></script>
(also i realise i'l开发者_如何学Pythonl have to create all.js somehow). Thanks!
You can set Response.Filter
.
Here is an interesting article. I haven't tried this, just did a search.
I know that Telerik does something similar for their controls.
http://geekswithblogs.net/rashid/archive/2007/07/25/Combine-Multiple-JavaScript-and-CSS-Files-and-Remove-Overheads.aspx
精彩评论