使用jQuery ThemeRoller实现主题

时间:2014-07-17 16:51:51

标签: jquery asp.net-mvc themeroller

我下载了一个主题,并通过我的BundleConfig.cs文件在相应的文件夹中添加了以下文件。进行以下修改后,当我显示我的网站时,我显然没有得到一个主题。它是普通的香草!我下载了一个特定的主题,检查了所有内容,并且不知道为什么网站不是主题。

有人可以告诉我原因吗?

using System.Web.Optimization;

namespace FuelTktImgRetrieval
{
    public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js",
                        "~/Scripts/jquery-ui-{version}.custom.min.js",
                        "~/Scripts/jquery.contextmenu.js",
                        "~/Scripts/jquery.jqGrid.min.js",
                        "~/Scripts/jquery.searchFilter.js",
                        "~/Scripts/jquery.tablednd.js",
                        "~/Scripts/jquery.simple-dtpicker.js",
                        "~/Scripts/grid.addons.js",
                        "~/Scripts/grid.locale-en.js",
                        "~/Scripts/grid.postext.js",
                        "~/Scripts/grid.setcolumns.js",
                        "~/Scripts/ui.multiselect.js",
                        "~/Scripts/jquery-ui-min.js",
                        "~/Scripts/jquery.js"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css",
                      "~/Content/jquery.simple-dtpicker.css",
                      "~/Content/ui.jqgrid.css",
                      "~/Content/ui.multiselect.css",
                      "~/Content/searchFilter.css",
                      "~/Content/jquery-ui-min.css",
                      "~/Content/jquery-ui-structure.min.css",
                      "~/Content/jquery-ui-theme.min.css"));

            bundles.Add(new StyleBundle("~/images/png").Include(
                "~/images/progress.gif",
                "~/images/ui-bg_diagonals-thick_75_f3d8d8_40x40.png",
                "~/images/ui-bg_dots-small_65_a6a6a6_2x2.png",
                "~/images/ui-bg_flat_0_333333_40x100.png",
                "~/images/ui-bg_flat_65_ffffff_40x100.png",
                "~/images/ui-bg_flat_75_ffffff_40x100.png",
                "~/images/ui-bg_glass_55_fbf8ee_1x400.png",
                "~/images/ui-bg_highlight-hard_100_eeeeee_1x100.png",
                "~/images/ui-bg_highlight-hard_100_f6f6f6_1x100.png",
                "~/images/ui-bg_highlight-soft_15_cc0000_1x100.png",
                "~/images/ui-icons_004276_256x240.png",
                "~/images/ui-icons_cc0000_256x240.png",
                "~/images/ui-icons_ffffff_256x240.png"));

            // Set EnableOptimizations to false for debugging. For more information,
            // visit http://go.microsoft.com/fwlink/?LinkId=301862
            BundleTable.EnableOptimizations = true;
        }
    }
}

然后,我更新了我的_Layout.cshtml文件。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - Fuel Ticket Image Display</title>
    @Styles.Render("~/Content/css")
    @Styles.Render("~/images/png")
    @Styles.Render("~/images/gif")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    <form id="ftForm">
        <div class="container body-content">
            @RenderSection("featured")
            @RenderBody()
            <hr />
            <footer style="align-content:center">
                <p><center>Ryder Inc. &copy; @DateTime.Now.Year.</center></p>
            </footer>
        </div>

        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/bootstrap")
        @RenderSection("scripts", required: false)
    </form>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

您是否检查过您的网站源代码,以查看该文件是否已添加到应用程序的标题中?

ASP.NET MVC不喜欢文件名中包含.min.的javascript文件。我不完全确定为什么,但最有可能的事实是.NET MVC的捆绑将缩小加载的文件。

如果您要将"~/Scripts/jquery-ui-{version}.custom.min.js"重命名为"~/Scripts/jquery-ui-{version}.custom.js",那么它应该加载得很好。您还需要对jGrid和JQuery UI文件执行相同的操作。