Is there a way to intercept and modify the html output stream in asp.net to combine javascript?

Is there a way to intercept the HTML output stream in asp.net and make changes? For example, using httpmodules or something else? I know that this is possible using Java servlets and assume that there should be an elegant way to do this using asp.net.

My goal is to combine multiple javascript files into one compound script, which has been reduced / packaged to speed up page loading.

For example, if my page usually displays the following in the page title:

<script type="text/javascript" src="/scripts/blah.js"></script> 
<script type="text/javascript" src="/scripts/yada.js"></script> 

I want to replace this with the following:

<script type="text/javascript" src="/scripts/all.js"></script> 

(I also understand that I will need to create all.js somehow). Thank!

+5

All Articles