11

All of my javascript and css combined. But when i'am looking they arent minified. I dont know why.

My bundle is shown below:

         bundles.Add(new Bundle("~/bundles/jqueryval").Include(
            "~/Scripts/jquery-ui.js",
            "~/Scripts/jquery.validate.js",
            "~/Scripts/grid.locale-tr.js",
            "~/Scripts/jquery.jqGrid.js",
            "~/Scripts/bootstrap.js",
            "~/Scripts/messages_tr.js",
             "~/Scripts/jquery.form.js"
           )
       );
        bundles.Add(new Bundle("~/bundles/mainjs").Include(
            "~/Scripts/jquery-1.10.2.js",
            "~/Scripts/bootstrap.js",
            "~/Scripts/superfish.js",
            "~/Scripts/jquery.flexslider.js",
            "~/Scripts/jquery.kwicks-1.5.1.js",
            "~/Scripts/jquery.easing.1.3.js",
            "~/Scripts/jquery.cookie.js",
            "~/Scripts/touchTouch.jquery.js"
           )
       );

        bundles.Add(new Bundle("~/bundles/allcss").Include(
           "~/Content/Css/bootstrap*",
           "~/Content/Css/opa-icons.css",
           "~/Content/Css/charisma-app.css",
           "~/Content/Css/ui.jqgrid.css",
           "~/Content/Css/jquery-ui.css"
           )
       );

        bundles.Add(new Bundle("~/bundles/maincss").Include(
           "~/Content/Css/bootstrap.css",
           "~/Content/Css/responsive.css",
           "~/Content/Css/style.css",
           "~/Content/Css/touchTouch.css",
           "~/Content/Css/kwicks-slider.css"
           )
       );

My global asax shown in below:

        protected void Application_Start()
    {
#if DEBUG
        BundleTable.EnableOptimizations = false;
#else
                    BundleTable.EnableOptimizations = true;
#endif
        AreaRegistration.RegisterAllAreas();
        WebApiConfig.Register(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);

        GlobalConfiguration.Configuration.MessageHandlers.Add(new CorsHandler());
    }

And:

 @System.Web.Optimization.Scripts.Render("~/bundles/mainjs")
 @System.Web.Optimization.Styles.Render("~/bundles/maincss")
1
  • 1
    Are you in Debug mode? What is the output HTML for script references? Commented Aug 27, 2013 at 0:38

2 Answers 2

20

They're not minified because you're using a Bundle instead of a ScriptBundle. A Bundle only bundles them (hey, what's in a word :) ) A ScriptBundle bundles and minifies.

Sign up to request clarification or add additional context in comments.

Comments

7

They are not minified cause you're probably in DEBUG mode.

try to set this

BundleTable.EnableOptimizations = true;

and see what happens.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.