0

Is the included bundle tool in MVC good enough? Is their any big reason not to use it?

I been working with squishIt in webforms and never been any problem. But now im on a MVC project and i've seen that MVC has it own bundle mecanism. So should I use that instead?

Can it minify and gzip? Does it add any hash on the merged file as squishIt does? Or is there any other solution on making the file unique on release?

Or is there any other one to use?

AthibaN
  • 2,087
  • 1
  • 15
  • 22
thatsIT
  • 2,085
  • 6
  • 29
  • 43
  • possible duplicate of [SquishIt vs. MVC 4.0 Bundler](http://stackoverflow.com/questions/14583168/squishit-vs-mvc-4-0-bundler) – mayabelle Sep 19 '13 at 15:01
  • It really does depend on who you ask. I wrote a IIS module which bundles and minifies. It plugs in to ASP.NET and I wrote it due to MVC not supporting bundling at the time. You can check it out and see if you like it. https://www.nuget.org/packages/RxLoader/ – Razor Sep 19 '13 at 23:36

2 Answers2

0

To answer your questions

  1. Yes it minifies / gzip
  2. Yes it adds a querystring to prevent caching
  3. And (not a question), but Bundling also works with webforms

I would recommend using whatever you feel most comfortable with. The built-in bundling is fine though and easy to use, and has nice features for debug/live deployments.

I HAVE found that the minifier doesn't minify as efficiently as some others, though this usually isn't an issue as it will use the .min file if one is provided.

Say your bundle includes all scripts in a folder, and that folder has jquery.1.10.2.js and jquery.1.10.2.min.js, it will use the unminified file in debug mode and it will use the .min version in release mode. Then if you remove the .min file, in release mode the bundle will likely be slightly larger, but the end result will still be a minified bundle.

More Reading on the ASP.NET Bundling

And yes there are other packages, like YUICompressor. You can search NuGet for them, but I've always used the built-in bundling so can't speak to how good they are.

MikeSmithDev
  • 15,731
  • 4
  • 58
  • 89
0

I discovered a really strange thing with the order of the output. Im using those files:

       bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Content/Script/json2.js",
                "~/Content/Script/jquery-1.10.2.min.js",
                "~/Content/Script/jqueryMobileCustom.js",
                "~/Content/Script/jquery.mobile-1.3.2.min.js"));

The folowing output will be:

    <script src="/Content/Script/jquery-1.10.2.min.js"></script>
    <script src="/Content/Script/json2.js"></script>
    <script src="/Content/Script/jqueryMobileCustom.js"></script>
    <script src="/Content/Script/jquery.mobile-1.3.2.min.js"></script>

That's wrong!

But if I change the name of "jquery-1.10.2.min.js" to this: "jquery.1.10.2.min.js". It work's as it should. And ordering them as I want.

Do you know if there is a way to disable sortorder when using scriptbundle and include? Or why even does it react on a ' - ' instead of a ' . ' in my files.

I know it is a 'BundleFileSetOrdering' function but I like to specify it with a include.

thatsIT
  • 2,085
  • 6
  • 29
  • 43