I suggest you ...

use action methods for rendering CSS and JavaScripts (like http://site.com/js/somejs).

It would make it possible to read the JavaScript or CSS from many sources, pack them together and then cache (OutputCache attribute).

161 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    vimpyboyvimpyboy shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    9 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Sergiy GalaySergiy Galay commented  ·   ·  Flag as inappropriate

        Telerik mvc controls already have such functionality (combine/pack/cache css/js files). It's very useful. It would be very nice to see that integrated into mvc framework

      • Emmanuel MoralesEmmanuel Morales commented  ·   ·  Flag as inappropriate

        This should be baked into the framework or provided as an extension and utilize a provider model to swap out the base implementation if desired.

      • Andrew PierroAndrew Pierro commented  ·   ·  Flag as inappropriate

        There are tons of great things like this out there. I am also using SquishIt myself now. However, this really should be a part of MVC as it is something which almost everyone is going to need at some point. Also, simple combining or packing is easy, but I would prefer to have an 'official MVC' solution which I new was going to handle all the URL rewrites correctly and would better support things like pulling the CSS/JS from an embedded resource.

      • johnjohn commented  ·   ·  Flag as inappropriate

        this is what i nearly do. slightly different. i have
        http://site.com/js/[files_basic_checksum].js
        where files_basic_checksum is the filename + lastmodifieddate + compressionlevel of the js files im including as one then md5ed.
        that way if i change one file, or decide to minify the file more, the url changes and the user gets a new copy.
        also since the url for that file will always be unique and if any changes to the files happen its a new URL, i can set the cache for that file for 10 years users only ever have to download it once.

        i also do this for CSS files.
        for master pages, i have a global set of css and js files I include on every page.

      Feedback and Knowledge Base