I suggest you ...

Use virtual file system for ASP.NET Bundling & Minification

Make ASP.NET Bundling & Minification (System.Web.Optimization) using the virtual file system to support bundling and minification of virtual files.

75 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…)
    LenneLenne shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    5 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...
      • MikeMike commented  ·   ·  Flag as inappropriate

        public override IEnumerable<BundleFile> EnumerateFiles(BundleContext context)
        {
        MyVirtualPathProvider virtualPathProvider = new MyVirtualPathProvider();
        IEnumerable<BundleFile> files = base.EnumerateFiles(context);

        foreach (BundleFile file in files)
        {
        file.VirtualFile = virtualPathProvider.GetFile(file.IncludedVirtualPath);
        }

        return files;


        }

      • MikeMike commented  ·   ·  Flag as inappropriate

        You can actually accomplish this by making your own class that derives from ScriptBundle or StyleBundle then override the EnumerateFiles files method. In this method replace the VirtualFile with one obtained from your own provider. Hope this helps.

      Feedback and Knowledge Base