具有 Bower 和 django-pipeline 的同一 JS 库的多个版本 [英] Multiple versions of same JS library with Bower and django-pipeline
问题描述
我在单页应用程序中使用的两个库是 moment 和 backgrid-moment-cell.我使用 bower 来管理我的前端库和 django-pipeline 用于资产打包.
Two of the libraries I use in my single page application are moment and backgrid-moment-cell. I use bower to manage my front-end libraries and django-pipeline for asset packaging.
我想使用 2.8.1 版本,但 backgrid-moment-cell 需要 ~2.5.0 版本.如何将这两个版本都放入我的项目中?
I'd like to use version 2.8.1 of moment, but backgrid-moment-cell requires version ~2.5.0. How can I get both version into my project?
推荐答案
前端开发应该使用单个依赖项,因为您希望最大限度地减少用户需要下载的代码量.Bower 可以帮助您管理这一点,这是使用它的主要好处.您有几个选择:
Front-end development should use a single dependency because you want to minimize the amount of code your users need to download. Bower helps you to manage this, which is a major benefit of using it. You have a few options:
- 手动命名模块,然后包含两者(真的不推荐)
- 在
bower 中使用
,但你可能会引入错误:resolutions
.json
- Manually namespace the modules then include both (really not recommended)
- Use
resolutions
inbower.json
, but you may introduce bugs:
"resolutions": {
"moment": "2.8.1"
}
- 要求维护者提升 bower 依赖版本(推荐)
这篇关于具有 Bower 和 django-pipeline 的同一 JS 库的多个版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!