Jun 24, 2011 at 2:35 AM
Edited Oct 24, 2011 at 5:28 PM
Is there a way to just have it serve one file of each CSS and JS?
This is slowing down PageLoad time alot.
Have anybody got this to work in BE 2.0 below?
The folder convention supported in the FileBundleHandler lets you reference a folder instead of just a file. Both the HTTP handler and the
BundleHelper.InsertFile understand when a folder is referenced and automatically bundles all the .js or .css files to a single response. So in order to bundle all the files in a given folder, simply reference the folder name and add the extension of
the types of files you want bundled. Having the folder structure above, you can add a bundle like so:
Notice that the file /scripts/common.js doesn’t exist, but the folder
/scripts/common does. By adding .js at the end, we tell the HTTP handler to look for all files with the same file extension – in this case .js files.
It bundles all the files in alphabetical order and serve the as a single response.
For security reasons, the HTTP handler will only serve .css and .js extensions.
I have tried using this code in the post above in BE 2.0 could not get it to work.
The .css and .js handlers are embedded in multi-able locations within BE 2.0.
Have anybody got this or something similar to work?