Because now the project JS reference a lot, inadvertently saw the MVC4 bundling, start feeling very good, will all the CSS,JS files compressed into a file processing, screen call is also very simple
So it took an afternoon to study it and test it in a variety of situations.
But the results are not satisfactory, there is a more maddening problem
often do. NET people know that the UI screen will refer to a lot of plug-ins, such as Easyui,ext and so on, and these plug-ins contain a lot of picture references, because the picture, it involves a web of common problems: path (of course, If the image path in all the CSS files is the absolute path used or the absolute path of the project, then there is no problem.
MVC4 bundling this should be a very OK function, but also the highlight of MVC4
But the burden is that the image path inside the CSS that was compressed by it, the original reference path relative to the CSS file becomes the relative path of the virtual path
For example: We define bundling in the project as follows
Bundles. ADD (New Scriptbundle ("~/content/css/infocss"). Include (
"~/content/skins/blue/css/iramecss/style.css",
"~/content/css/basecss/infoform.css"
));
Where, ("~/content/css/infocss") is the virtual path, the compressed path is not according to the relative path of the contained CSS file that we define, but instead becomes the relative path of the virtual path, at this time, We have to set the virtual path for each CSS file considering the image path used inside. Because I only need a screen to call three CSS files, and the original path is different, so feel that if modified, the outweigh the
The second question, if my CSS file or JS file itself set parameters, such as Query.artdialog.js?skin=blue, the original design is based on the skin parameters here, JS reference different CSS files, if the use of bundling, It can only be called separately.
Other small problems, because of the time, I did not carry on the test, in the view of other bloggers to use bundling, as if mentioned, for the JS belt. min File, bundling not compressed, and the file is not imported. Can only be directly in the UI screen reference, and even if the JS file name changed, the. Min to remove, but itself is compressed files, if the compression, will there be any problem?