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

问题描述

我正在制作一个使用Twitter凉亭的新项目.我创建了一个component.json来维护我的所有依赖,例如jquery.然后,我运行bower install,将所有内容安装在名为components的文件夹中.但我需要将组件安装在其他文件夹中,例如public/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但它不起作用.

推荐答案

在项目根目录(与您的主目录相对),内容如下:

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的默认组件文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:26