- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我运行了“yo Angular”,后来意识到它安装了 1.0.8,我卸载了 Angular 组件,但是当我重新添加所有内容时,原始的 Bower.json 文件在“devDependency”下有 Angular-Mocks 和 Angular-Scenario 1.2.0-rc.2 组件 Angular-Mocks 和 Angular-Scenario 位于依赖项下,而不是 devDependency 下。
我很好奇 devDependency 是如何使用的,以及我是否应该手动修复它或保持原样。有没有办法在 Bower CLI 上指定如何将某些内容标记为开发依赖项?
编辑文件后:
{
name: "Angular",
version: "0.0.0",
dependencies: {
json3: "~3.2.4",
jquery: "~1.9.1",
bootstrap-sass: "~2.3.1",
es5-shim: "~2.0.8",
angular-mocks: "1.2.0-rc.2",
angular-sanitize: "1.2.0-rc.2",
angular-resource: "1.2.0-rc.2",
angular-cookies: "1.2.0-rc.2",
angular: "1.2.0-rc.2",
angular-scenario: "1.2.0-rc.2"
},
devDependencies: { }
}
编辑前:
{
"name": "Angular",
"version": "0.0.0",
"dependencies": {
"angular": "~1.0.7",
"json3": "~3.2.4",
"jquery": "~1.9.1",
"bootstrap-sass": "~2.3.1",
"es5-shim": "~2.0.8",
"angular-resource": "~1.0.7",
"angular-cookies": "~1.0.7",
"angular-sanitize": "~1.0.7"
},
"devDependencies": {
"angular-mocks": "~1.0.7",
"angular-scenario": "~1.0.7"
}
}
最佳答案
devDependency
用于与开发相关的脚本,例如单元测试、打包脚本、文档生成等
依赖项
是生产使用所必需的,并且假设开发也需要。
在依赖项
中包含devDependency
(如您所拥有的那样)不会有害;该模块只会在安装过程中捆绑更多文件(字节) - 消耗更多(不必要的)资源。从纯粹的观点来看,这些额外的字节可能是有害的,这取决于您的观点。
为了阐明一些情况,请查看 bower help install
,在模块安装过程中可以通过 -p
或--生产
,例如:
bower install angular-latest --production
这是对除开发平台以外的任何平台执行安装的推荐方法。
相反,无法省略依赖项
下列出的模块。
从 bower@1.2.7 开始(请参阅 bower latest source ),bower help
产生:
Usage:
bower <command> [<args>] [<options>]
Commands:
cache Manage bower cache
help Display help information about Bower
home Opens a package homepage into your favorite browser
info Info of a particular package
init Interactively create a bower.json file
install Install a package locally
link Symlink a package folder
list List local packages
lookup Look up a package URL by name
prune Removes local extraneous packages
register Register a package
search Search for a package by name
update Update a local package
uninstall Remove a local package
Options:
-f, --force Makes various commands more forceful
-j, --json Output consumable JSON
-l, --log-level What level of logs to report
-o, --offline Do not hit the network
-q, --quiet Only output important information
-s, --silent Do not output anything, besides errors
-V, --verbose Makes output more verbose
--allow-root Allows running commands as root
See 'bower help <command>' for more information on a specific command.
此外,bower help install
会产生(请参阅 latest source ):
Usage:
bower install [<options>]
bower install <endpoint> [<endpoint> ..] [<options>]
Options:
-F, --force-latest Force latest version on conflict
-h, --help Show this help message
-p, --production Do not install project devDependencies
-S, --save Save installed packages into the project's bower.json dependencies
-D, --save-dev Save installed packages into the project's bower.json devDependencies
Additionally all global options listed in 'bower help' are available
Description:
Installs the project dependencies or a specific set of endpoints.
Endpoints can have multiple forms:
- <source>
- <source>#<target>
- <name>=<source>#<target>
Where:
- <source> is a package URL, physical location or registry name
- <target> is a valid range, commit, branch, etc.
- <name> is the name it should have locally.
关于Bower 和 devDependencies 与依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19339227/
我刚刚升级到Bower 1.0,做了一个bower install,发现了一堆新的.bower.json文件(注意前导时期)。 我在changelog或文档中没有找到对.bower.json的引用。我
Bower 的网站描述了 Bower.json 中的 ignore 键: ignore [array]: An array of paths not needed in production that
我已经在我的项目根目录中添加了一个 bower 包。我正在使用 bower,因此可以更轻松地管理每个组件的更新(bower 的功能之一)。但是我在安装后收到了这条消息: no-json No bowe
当我通过以下方式从 git repo 安装库时: bower install git@github.com:fabiantheblind/p5.js.git --save 该组件被克隆到我的 bowe
我已经为 Bower 设置了一个 Nexus 代理注册表。我正在使用 Debian 9。bower 版本是 1.8.8,安装了 bower-nexus3-resolver(版本 1.0.4)。我的 .
是否可能只有一个可以从 Bower“安装”的存储库? 目前我已经注册了一个连接到开发库的 bower 包,但是在运行时 bower install我只想要 dist要下载的文件。 我见过有人保留两个存
我正在尝试安装 https://github.com/aterrien/jQuery-Knob通过 bower 。在包的 bower.json 文件中,我看到: { "name": "aterrien
我正在尝试通过 bower 安装本地 Jquery ui。 我有一个名为 jquery-ui 的本地文件夹并运行了以下命令 bower install jquery-ui/jquery-ui.min.
我正在研究如何使用 bower 安装软件包。 当我 'bower install packagename' 时,软件包安装在/app/components/中。 但是,我想自己决定项目的结构。 有没有
$ bower install angular-animate --save bower cached git://github.com/angular/bower-angular-animate.g
我正在使用 bower 从下面的 bower.json 中查看依赖项,所以问题是我希望 bower 提供更新版本发布的依赖项报告但不安装它,对于使用 npm-check-updates for npm
一些库在其 Github 存储库中没有已经构建的 JavaScript 文件,因为这些库的作者反对保留构建工件(例如 Sinon.JS)。是否有使用 Bower 处理此问题的首选方法? 我知道我可以
我想运行我自己的 bower 服务器来开始跨团队共享几个内部模块。我很难找到运行您自己的服务器的信息。在 bower.io 网站上有这条线 N.B. To run your own Bower End
在 *nix 上,bower 使用 ~/.bower其缓存的文件夹(包等)。 我想将其更改为其他位置。 bower spec来自的文档建议我配置 storage输入我的.bowerrc . 我在我的项
我有一个项目依赖于另一个使用 Bower 的项目。我要 bower install当我在父项目上运行它时也运行在该组件上。到目前为止,我还没有在 configuration spec 中找到任何东西,
如何在不提供 bower.json 中的用户凭据的情况下将访问受限存储库作为依赖项添加到 bower.json? 即我想避免像这样指定它: { "dependencies": { "ang
Bower 文档说 N.B. If you aren't authoring a package that is intended to be consumed by others (e.g., yo
我正在下载 Angular、Angular-Bootstrap 和 Bootstrap with Bower。 Bootstrap 依赖于进程中安装的 jquery。但我的项目中不需要它,因为我只使用
我正在尝试为使用 Bower 的应用程序设置自动包构建。 postinstall中进入bower install时,bower提示: [?] May bower anonymously report
我想将特定分支的最新版本指定为依赖项。具体来说,我想在 Bootstrap v3.0 发布之前使用它。 将其指定为 Bower 中的依赖项的最佳方法是什么? 最佳答案 您需要使用#、appended
我是一名优秀的程序员,十分优秀!