【问题标题】:How can I get bootswatch theme to work with my Gruntfile.js?如何让 bootswatch 主题与我的 Gruntfile.js 一起使用?
【发布时间】:2015-03-03 18:57:03
【问题描述】:

问题

我已将 bootswatch slate 主题安装到我的 bower.json 中。我这样做如下:

  • bower install bootswatch-dist#slate
  • grunt

不幸的是,当我的 Grunftile 被调用时,它不会使用 bootswatch 更新我的 wwwroot 组件。我究竟做错了什么?

bower.json

 {
      "name": "SampleLibrary",
      "version": "0.0.0",
      "license": "MIT",
      "private": true,
      "dependencies": {
        "jquery-validation": "~1.13.1",
        "jquery-validation-unobtrusive": "~3.2.2",
        "bootstrap": "~3.3.2",
        "jquery-ui": "~1.11.3",
        "bootswatch-dist": "slate"
      }
    }

Gruntfile.js

module.exports = function (grunt) {
    grunt.initConfig({
        bower: {
            install: {
                options: {
                    targetDir: "wwwroot/lib",
                    layout: "byComponent",
                    cleanTargetDir: false,

                }
            }
        }

    });

    //This command registers the default task which will install bower packages into wwwroot/lib 
    grunt.registerTask("default", ["bower:install"]);

    //This command loads the grunt plugins
    grunt.loadNpmTasks("grunt-bower-task");
};

尝试

我按照这些资源给出的指示进行操作:

真正令人沮丧的是,在 bower.json 文件中列为依赖项的所有其他内容都转到 wwwroot,但 bootswatch 除外。我能够使用 bower install 将 bootswatch 放入 bower 文件,但是我的 Gruntfile.js 忽略了它?

我真的很困惑。请帮忙。 ASP.NET5 和 MVC6 有很大的前景,但是试图弄清楚如何引入新的依赖项比我最初想象的要棘手。

【问题讨论】:

    标签: json gruntjs bower asp.net-core visual-studio-2015


    【解决方案1】:

    答案是直接使用bootswatch如下:bower install bootswatch

    【讨论】:

      【解决方案2】:

      如果您添加版本,那么它会安装所有记录在案的资产。因此,在您的 bower.json 文件中添加以下内容:

      "bootswatch-dist": "3.3.5-slate",

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-11-14
        • 2020-01-22
        • 2021-04-20
        • 2019-06-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多