What’s Next for ASP.NET Web Optimization

Now that Visual Studio 2012 is done, we’re busy figuring out what we should do next.  For Web optimization, there are a few key scenarios that we know we want to support moving forward:

  • Design and build-time optimization and generation of static, versioned files that can be deployed to the server/cdn/etc.
  • Virtual path provider support (this is to-date, the most requested addition)
  • Richer CDN fallback

There are also a whole bunch of other scenarios that we’ve either heard from different people or come up with during brainstorming.  For example:

  • Inline script optimization
  • Work more easily with client side script loaders
  • Optimize HTML
  • Resolve relative paths that change when a resource is bundled (e.g. css that references an image using a relative path)
  • And many more…

So with the future in mind I have 2 questions for you.  The first is a general, “what are you looking for?”  Do some of the items listed above resonate with you?  Is there something you want to make sure we’re considering?

The second question deals with a change in design philosophy for the optimization framework.  When we first designed the framework, it was an explicit goal to limit the scope of modifications that we performed on your scripts and styles (limited, because minifying is obviously an operation that modifies your content).  This is because the greater the delta that exists between the code you wrote and the code that gets pushed to the browser, the greater the difficulty in debugging.

However, several of the scenarios that we’re considering for future versions will require us to move further away from this initial goal.  For example, to correctly resolve relative paths to images from within bundled CSS, we will need to modify the image URL.  Optimizing inline scripts and/or HTML will require modifying the page content itself.  These are just a few of many different examples of where developer content modification will be necessary.

So my second question is – is original content modification/rewriting an issue for you?  Or is it one of those concerns that we’ve been carrying simply because it’s a concern we’ve been carrying?

About Howard Dierking

I like technology...a lot...
This entry was posted in Web. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://myleschambers.webstarts.com/ HerrodFrye

    I would like to see some way to define asset dependencies, like a server-side require That way I also say, This view needs jQuery UI and have it automatically pull in jQuery, maybe the base theme CSS.

  • Chris Coleman

    AMD Module packaging (similar to using require.js optimizer through r.js) to do the initial file packaging based on the requirements in the projects js modules. This goes beyond just packaging/minification, it runs require.js as part of the build process to figure out dependencies and pack what is needed together based on required modules. It also packages and renames stuff based on the define pattern.
    ( http://requirejs.org/docs/api.html#modulename )

    ( https://github.com/jrburke/r.js#what-makes-it-special )

    ( http://bundletransformer.codeplex.com/discussions/392254 )

  • Ankur

    Great work. I am highly obliged that you are sharing such info with us. I would appreciate if you will post on daily basis and that too with good typical info which i didn’t get from anywhere. Being an ASP.net aspirant at http://www.wiziq.com/course/57-fresher-training-projects, I really appreciate your work

  • http://twitter.com/koenwillemse Koen Willemse

    For me VirtualPathProvider support is most important, since we can’t use the optimizations now.

  • http://dmytroduk.com/ Dmytro Duk

    Virtual path provider support is the most required for now.

    Original content modification is not a big issue as for me. Maybe would be good if I could disable minification for bundled resources to debug it.

    Inline style/script minification and bundling out of the box would be nice, but it is pretty easy to implement with current framework version.
    Other thing is that current framework looks like designed to serve static style/script files. The most common scenario is to setup the system in global.asax and don’t change anything later.
    Inline scripts, styles and HTML are more dynamic, often it depends on current context. Probably not all dynamic resources can be bundled. And it would be really strange to use virtual paths as bundle identifiers in this case.

  • http://aspnetperformance.com/ Matt Perdeck

    As regards the change in design philosophy: To me, the difference between source script/css and deployed script/css is like the difference between source c# and deployed c# – the source version is human readable with good comments, etc, the deployed version is totally optimised for processing by the server (and therefore compiled into dlls in the case of c#).
    It would be great if we could compile javascript and css to bytecode and send the bytecode to the server (fewer bytes over the wire, faster execution), but I realise that’s just a dream for now.

    So yes, please to optimise script code, update image urls in combined css files, and make any other changes needed to make the site run faster on the server. Don’t worry about debugging the modified code. You can’t really debug minimised code anyway IMHO, just as I wouldn’t try to debug compiled DLLs – I try to reproduce any production problem on my dev machine using the source code, then fix the problem in the source code.

  • Anonymous

    Hey John – HTTP compression is generally something handled by the Web server (or middleware if you’re in that world).  Am I reading your suggestion incorrectly?

  • http://www.facebook.com/nik.coughlin Nik Coughlin

    I have no problem with content modification, just so long as it’s opt-in rather than by default.

  • Hashimakhtar

    I would like to see JavaScript treated as a first class citizen like C#.

  • Anonymous

    The one thing that’s been bugging me since the start is the fact that the ScriptManager control and ClientScriptManager class require a server form. About 70% of my WebForms pages don’t need a server form, but without one, I have to re-invent the whole script registration wheel.

    And yes, I know “WebForms sucks, use MVC/WebApi/something else”, but given the push for “One ASP.NET”, doesn’t WebForms deserve some attention too?

    I mentioned this a few years back and was told “we’re working on it”. Since then, there’s been no progress on this issue. It’s not particularly hard to roll my own alternative, but I’d rather have the built-in version just work!

  • Schmulik Raskin

    Some of the things I would like to see such a framework support:

    Supporting a greater number of frameworks and libraries, and providing extensibility points are important to me. For example, to allow me to compile CoffeeScript, SASS, Less, to allow running the RequireJS optimizer, some of which require server-side JavaScript.

    Support for compile-time generation, with a decent command-line, using for example the NuGet PowerShell console.

    I personally don’t have any problem with the framework making changes to output files, I am already doing that when minimizing and transpiling, and this would allow for some additional features.

    For example, support for server-side ‘require’ in JavaScript files, which would affect 

    1. IntelliSense – no need for _reference.js

    2. An implicit build order when referencing and optimizing – no need for specifying an explicit order in a bundle

    See http://getcassette.net/documentation/AssetReferences for an example.

  • Mike

    + for the generation of static files
    +1 for working with script loaders, also with requirejs
    + work with LESS to support ‘automatic’ spriting

    Thanks for listening!

  • Richard Adleta

    IMHO, I would love to see compile time bundling of CSS/JS/etc. It’s costly to use the runtime based [insert your bundler here] when you are under heavy load and do frequent deployments. One additional reason is to be able to tell at compile time the bundle is broken.

  • Travis Illig

    I would love to see some way to define asset dependencies, like a server-side “requirejs” mechanism. That way I could say, “This view needs jQuery UI” and have it automatically pull in jQuery, maybe the base theme CSS, etc.

    It would also be nice to have some way to normalize logical dependencies. If, at one point, something includes jQuery 1.7.1 and later something else includes jQuery 1.7.2 in a bundle, it’d be nice to be able to only include jQuery once, and only the latest version. That would make it much more usable in a composite app scenario, where different views require different things and master pages, partial views, etc., may all try to register the same thing repeatedly.

  • Travis Illig

    I would love to see some way to define asset dependencies, like a server-side “requirejs” mechanism.

  • Anonymous

    I second this motion. SourceMap support would be huge.

  • Pingback: The Morning Brew - Chris Alcock » The Morning Brew #1161

  • John Conan

    HTTP Compression for shared hosting.

  • Anonymous


    Sorry to post this as a reply, it won’t let me paste when editing the post :-/

  • Anonymous

    I think this is what Anon might be referring to but WRT this:

    This is because the greater the delta that exists between the code you wrote and the code that gets pushed to the browser, the greater the difficulty in debugging.

    Please help out the SourceMap efforts which solve this for minification and other mapping scenarios (CoffeeScript, SASS, SCSS, less, etc).

    Seriously – once support for such maps is pervasive in tooling (especially debuggers), it’ll help with all kinds of development. :)

  • Anon

    if you’re going to modify the scripts etc. please support the mapping abilities of e.g. chrome.

  • Andrew Freese

    ++Virtual path provider support
    And (except for virtual path resolution) I would be concerned about too much rewriting of my content. I’m paranoid :)

  • CurtW

    Only somewhat related to optimization, but I would like to see Refactor->Rename support for JavaScript in Visual Studio.