So I have an ASP.NET MVC app that references a number of javascript files in various places (in the site master and additional references in several views as well).
<
I personally think that keeping the files separate during development is invaluable and that during production is when something like this counts. So I modified my deployment script in order to do that above.
I have a section that reads:
And in my master page file I use:
if (HttpContext.Current.IsDebuggingEnabled)
{%>
<%
} else {%>
<% } %>
The build script takes all the files in the section and combines them all together. Then I use YUI's minifier to get a minified version of the javascript. Because this is served by IIS, I would rather turn on compression in IIS to get gzip compression. **** Added **** My deployment script is an MSBuild script. I also use the excellent MSBuild community tasks (http://msbuildtasks.tigris.org/) to help deploy an application.
I'm not going to post my entire script file here, but here are some relevant lines to should demonstrate most of what it does.
The following section will run the build in asp.net compiler to copy the application over to the destination drive. (In a previous step I just run exec net use commands and map a network share drive).
After all of the solution projects are copied over I run this:
That should be enough to get you started on automating deployment. I put all this stuff in a separate file called Aspnetdeploy.msbuild. I just msbuild /t:Target whenever I need to deploy to an environment.