如何更改 Bower 的默认组件文件夹? [英] How to change bower's default components folder?

查看:41
本文介绍了如何更改 Bower 的默认组件文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个使用来自 twitter 的 bower 的新项目.我创建了一个 component.json 来维护我的所有依赖项,例如 jquery.然后我运行 bower install 将所有内容安装在一个名为 components 的文件夹中.但我需要将组件安装在不同的文件夹中,例如公共/组件.

I'm making a new project that uses bower from twitter. I created a component.json to maintain all my dependency like jquery. Then I run bower install that installs everything in a folder named components. But I need to install the components in a different folder, e.g. public/components.

我尝试将 components.json 编辑为:

I have tried editing my components.json into:

{
  "name": "test",
  "version": "1.0.0",
  "directory": "public/",
  "dependencies": {
    "jquery": "*"
  }
}

或:

{
  "name": "test",
  "version": "1.0.0",
  "componentsDirectory": "public/",
  "dependencies": {
    "jquery": "*"
  }
}

如图所示https://github.com/twitter/bower/pull/94 但它不起作用.

as shown in https://github.com/twitter/bower/pull/94 but it doesn't work.

推荐答案

创建一个Bower配置文件.bowerrc 在项目根目录(而不是您的主目录)中包含以下内容:

Create a Bower configuration file .bowerrc in the project root (as opposed to your home directory) with the content:

{
  "directory" : "public/components"
}

再次运行bower install.

这篇关于如何更改 Bower 的默认组件文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆