如何让bootswatch主题与我的Gruntfile.js一起使用?

时间:2015-03-03 18:57:03

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

问题

我已将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有很大的希望,但是试图弄清楚如何引入新的依赖关系已经证明比我最初想象的更棘手。

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:1)

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

“bootswatch-dist”:“3.3.5-slate”,