【问题标题】:Is it possible to update bower dependencies using grunt?是否可以使用 grunt 更新 bower 依赖项?
【发布时间】:2015-08-20 11:00:54
【问题描述】:

我正在使用 grunt 开发一个网站,并且想知道是否可以在我的“构建”grunt 任务中更新我的项目中的 bower 依赖项 - 这样当我构建一个生产版本的我的项目,一切都是最新的吗?

显然,我知道我可以在grunt build:prod 之前执行bower update,但每次都会少一个步骤。

只是好奇!

【问题讨论】:

    标签: gruntjs dependencies task packages bower


    【解决方案1】:

    找到了一个很好的解决方案——我会发布它以防它对某人有用……

    grunt-bower-install-simple 插件允许您通过将 command 选项设置为 update 来更新来自 grunt 任务的 bower 依赖项,如下所示:

    "bower-install-simple": {
    
        options: {
            color: true,
            directory: "src/bower_components"
        }
    
        "prod": {
            options: {
                command: update,
                production: true
        }
    }
    

    【讨论】:

      【解决方案2】:

      Grunt 有一个名为 grunt-bower-task 的任务,它可以帮助您管理 bower 依赖项。使用官方 grunt 文档了解详细信息。

      【讨论】:

        【解决方案3】:

        找到一种可能的解决方案:

        我想我可以使用 grunt-shell 在 shell 中自动运行 bower update 命令……

        只是想知道这是否是最合乎逻辑/最复杂的方法。还有其他建议吗?

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-08-08
          • 2014-10-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-09-22
          • 1970-01-01
          相关资源
          最近更新 更多