-1

In my MVC application, Initially I called all the scripts and styles in Each page. After seeing the Bundling concept. I referred the scritps and styles in the Bundle.config page. Here the scripts are not referred in my page. I dont use a Layout page in my application.

Bundle.config

    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/jquery-{1.7.1}.js"));

    bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                "~/Scripts/jquery-ui-{1.8.20}.js"));
    bundles.Add(new ScriptBundle("~/bundles/jqueryuc").Include(
                "~/Scripts/jquery.dcmegamenu.1.3.3.js",
                "~/Scripts/jquery.hoverIntent.minified.js"));

    bundles.Add(new ScriptBundle("~/bundles/jqueryuh").Include(
                "~/Scripts/html5.js"));

    bundles.Add(new ScriptBundle("~/bundles/jqueryumin").Include(
                "~/Scripts/jquery.uniform.min.js"));


    bundles.Add(new ScriptBundle("~/bundles/jqueryea").Include(
                "~/Scripts/jquery.easing.1.3.js",
                "~/Scripts/jquery.hoverIntent.minified.js"));

    bundles.Add(new StyleBundle("~/CSS/css").Include(
                "~/CSS/AdminLayStyle.css",
                "~/CSS/tab.css",
                "~/CSS/login.css", 
                "~/CSS/login-box.css",
                "~/CSS/base.css",
                "~/CSS/style_file.css",
                "~/CSS/menustyle.css"));

    bundles.Add(new StyleBundle("~/CSS/Content/themes/base/css").Include("~/CSS/Content/themes/base/jquery-ui.css",
                "~/CSS/Content/themes/base/jquery.ui.all.css",
                "~/CSS/Content/themes/base/jquery.ui.base.css",
                "~/CSS/Content/themes/base/jquery.ui.dialog.css",
                "~/CSS/Content/themes/base/jquery-ui.css", 
                "~/CSS/Content/themes/base/jquery.ui.theme.css"));

and in View Index.cshtml

 @Scripts.Render("~/bundles/jquery")
 @Scripts.Render("~/bundles/jqueryui")
 @Scripts.Render("~/bundles/jqueryuc")
 @Styles.Render("~/Content/css")

Is the reference to styles from Bundle.config is correct ??
Thanks in advance.
EDIT :
Is it any rule that all styles should be referred only from Content folder ??

kk1076
  • 1,740
  • 13
  • 45
  • 76

2 Answers2

2

Javascripts seem fine. The CSS is wrong. There isn't any ~/Content/css bundle defined. You probably meant:

@Styles.Render("~/CSS/css")

Also you probably want to include the jQuery UI styles as well:

@Styles.Render("~/CSS/Content/themes/base/css")
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Is it only inside in Content folder, we should refer styles ??. I used it in a separate folder called CSS. – kk1076 Apr 01 '13 at 06:55
  • 1
    No, you could place your static files wherever you want. The only place you cannot use is `~/App_Data` and `~/Views`. – Darin Dimitrov Apr 01 '13 at 07:20
0

I got it. The relative path to refer the styles and Images must be from Content folder.

kk1076
  • 1,740
  • 13
  • 45
  • 76