具有Bower和django管道的相同JS库的多个版本 [英] Multiple versions of same JS library with Bower and django-pipeline

查看:141
本文介绍了具有Bower和django管道的相同JS库的多个版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单页应用程序中使用的两个库是时刻 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?

推荐答案

前端开发应该使用单个依赖关系,用户需要下载的代码量。鲍尔帮助你管理这个,这是使用它的主要好处。您有几个选项:

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.json ,但您可能会出现错误:

  • Manually namespace the modules then include both (really not recommended)
  • Use resolutions in bower.json, but you may introduce bugs:
"resolutions": {
    "moment": "2.8.1"
}




  • 请求维护者碰撞保险杠依赖版本(推荐)

  • 这篇关于具有Bower和django管道的相同JS库的多个版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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