EnableClientUrls Remove whitespace and new lines.

Feb 12, 2011 at 8:35 PM

By default calling @Url.EnableClientUrls generates the following code:

    <script type="text/javascript">
    var Combres=Combres||{};
    Combres.Urls=Combres.Urls||{};
    (function() {
        var urls={siteCss:'/combres.axd/siteCss/-1261607049/',dotLessCss:'/combres.axd/dotLessCss/1328800956/',siteJs:'/combres.axd/siteJs/1312894718/'};for(attrName in urls)Combres.Urls[attrName]=urls[attrName];
    })();
</script>

 

I think the above code be optimzed by removing newlines and whitespaces. also renaming some variables. Might look a bit cryptic but I think it will help in minimizing the size.

<script type="text/javascript">var Combres=Combres||{};Combres.Urls=Combres.Urls||{};(function(){var u={siteCss:'/combres.axd/siteCss/-1261607049/',dotLessCss:'/combres.axd/dotLessCss/1328800956/',siteJs:'/combres.axd/siteJs/1312894718/'};for(a in u) Combres.Urls[a]=u[a];})();</script>
Coordinator
Feb 14, 2011 at 10:41 AM

Thanks for the suggestion.  I've modified & uploaded the code.