Agreed, that would be useful. In addition, with IIS 7 you do something like this to future expire resources in general:
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="60.00:00:00" />
</staticContent>
....
</system.webServer>
What I'd also like to see is if Coolite can combine its different JavaScript files into one, and same with CSS (including any custom themes) to minimize HTTP requests. (On a smaller scale it can improve GZip compression if you have enabled it on IIS a bit because there are more repeated patterns but the reduced HTTP requests is the big win in this particular situation)
Lastly, I wonder if there is a way to combine all the Coolite JavaScript files with any other JavaScript files.
For example, a large app I work on isn't fully Coolite so uses ASP.NET Ajax and other control vendors. So, in my main master page I have this:
<%-- //script combining courtesy http://www.hanselman.com/blog/Commen...d5ed14a2a2--%>
<asp:ScriptManager ID="ScriptManager" runat="server" CompositeScript-ScriptMode="Release">
<CompositeScript>
<Scripts>
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<asp:ScriptReference Name="MicrosoftAjax.js" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<asp:ScriptReference Name="MicrosoftAjaxWebForms.js" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<asp:ScriptReference Path="~/my/custom/js1.js" />
<asp:ScriptReference Path="~/my/custom/js2.js" />
</Scripts>
</CompositeScript>
</asp:ScriptManager>
In the code behind for the master page, I offer this method to any pages wanting to add more scripts into the mix:
public void AddScript(string url)
{
if (string.IsNullOrEmpty(url) || url.Trim().Length == 0)
{
throw url == null ? new ArgumentNullException("url") : new ArgumentException("url");
}
ScriptReferenceCollection scripts = AspNetScriptManager.CompositeScript.Scripts;
if (!ScriptManagerUtility.ScriptManagerContains(scripts, url))
{
AspNetScriptManager.CompositeScript.Scripts.Add(new ScriptReference(url));
}
}
Its not perfect as different pages adding their own script means it is less likely to be cached for different pages, but in my particular case that is okay.
It would be nice to have a way to include the ExtJs/Coolite JS in the composite script, or maybe Coolite has its own way to do this that could also take external scripts in the same way as above???