c# - Why are my bundles not loaded even when they have been included in the BundlesConfig? -


i have jquery, bootstrap bundles wish load in view, have added them bundlesconfig , added view in @script.render, scripts files not rendering cannot make use of bootstrap tags.

bundles

using system.web; using system.web.optimization;  namespace xxxx {     public class bundleconfig     {         // more information on bundling, visit http://go.microsoft.com/fwlink/?linkid=254725         public static void registerbundles(bundlecollection bundles)         {             bundles.add(new scriptbundle("~/bundles/jquery").include(                         "~/scripts/jquery-{version}.js",                         "~/scripts/bootstrap.js"));              bundles.add(new scriptbundle("~/bundles/jqueryui").include(                         "~/scripts/jquery-ui-{version}.js"));              bundles.add(new scriptbundle("~/bundles/jqueryval").include(                         "~/scripts/jquery.unobtrusive*",                         "~/scripts/jquery.validate*"));              // use development version of modernizr develop , learn from. then, when you're             // ready production, use build tool @ http://modernizr.com pick tests need.             bundles.add(new scriptbundle("~/bundles/modernizr").include(                         "~/scripts/modernizr-*"));              bundles.add(new stylebundle("~/content/css").include(                 "~/content/site.css",                 "~/content/bootstrap.css"));              bundles.add(new stylebundle("~/content/themes/base/css").include(                         "~/content/themes/base/jquery.ui.core.css",                         "~/content/themes/base/jquery.ui.resizable.css",                         "~/content/themes/base/jquery.ui.selectable.css",                         "~/content/themes/base/jquery.ui.accordion.css",                         "~/content/themes/base/jquery.ui.autocomplete.css",                         "~/content/themes/base/jquery.ui.button.css",                         "~/content/themes/base/jquery.ui.dialog.css",                         "~/content/themes/base/jquery.ui.slider.css",                         "~/content/themes/base/jquery.ui.tabs.css",                         "~/content/themes/base/jquery.ui.datepicker.css",                         "~/content/themes/base/jquery.ui.progressbar.css",                         "~/content/themes/base/jquery.ui.theme.css"));         }     } } 

_layout.cshtml

<!doctype html> <html> <head>     <meta charset="utf-8" />     <meta name="viewport" content="width=device-width" />     <title>@viewbag.title</title>     @styles.render("~/content/css")     @scripts.render("~/bundles/modernizr") </head>     <body>         <div>             <p>this test</p>         </div>         @renderbody()          @scripts.render("~/bundles/jquery")         @rendersection("scripts", required: false)     </body> </html> 

view

@{     viewbag.title = "search";     layout = "~/views/shared/_layout.cshtml"; }  <div class="jumbotron">     <div class="container">         <h1>find</h1>         <div class="row">             <div class="col-lg-6">                 <div class="input-group">                     <input type="text" class="form-control" placeholder="search for...">                     <span class="input-group-btn">                         <button class="btn btn-primary" type="button">go!</button>                     </span>                 </div>             </div>         </div>     </div> </div> 

rendered html

<!doctype html>  <html> <head>     <meta name="viewport" content="width=device-width" />     <title>search</title>   </head> <body>     <div>   <div class="jumbotron">     <div class="container">         <h1>find</h1>         <div class="row">             <div class="col-lg-6">                 <div class="input-group">                     <input type="text" class="form-control" placeholder="search for...">                     <span class="input-group-btn">                         <button class="btn btn-primary" type="button">go!</button>                     </span>                 </div>             </div>         </div>     </div> </div>      </div> </body> </html> 

it’s important note bundle , minification different process. asp.net site explains as: bundling bundling new feature in asp.net 4.5 makes easy combine or bundle multiple files single file. can create css, javascript , other bundles. fewer files means fewer http requests , can improve first page load  performance. minification minification performs variety of different code optimizations scripts or css, such removing unnecessary white space , comments , shortening variable names 1 character. consider following javascript function.

back question:asp.net mvc 4 bundles has ignore list. , .min extension included in ignore list. override ignore list:

bundles.ignorelist.clear(); 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -