如何下載js類庫

https://bower.io/? 這個已經淘汰

https://learn.jquery.com/jquery-ui/environments/bower/

Web sites are made of lots of things — frameworks, libraries, assets, and utilities. Bower manages all these things for you.

Keeping track of all these packages and making sure they are up to date (or set to the specific versions you need) is tricky. Bower to the rescue!

Bower can manage components that contain HTML, CSS, JavaScript, fonts or even image files. Bower doesn’t concatenate or minify code or do anything else - it just installs the right versions of the packages you need and their dependencies.

To get started, Bower works by fetching and installing packages from all over, taking care of hunting, finding, downloading, and saving the stuff you’re looking for. Bower keeps track of these packages in a manifest file, bower.json. How you use packages is up to you. Bower provides hooks to facilitate using packages in your tools and workflows.

Bower is optimized for the front-end. If multiple packages depend on a package - jQuery for example - Bower will download jQuery just once. This is known as a flat dependency graph and it helps reduce page load.

?

Install Bower

Bower is a command line utility. Install it with npm.

npm install -g bower

Bower requires node, npm and git.

Latest release: bower version

For troubleshooting installation on different platforms, read the troubleshooting wiki page.

?

Getting started

Install packages

Install packages with bower install. Bower installs packages to bower_components/.

bower install <package>

A package can be a GitHub shorthand, a Git endpoint, a URL, and more. Read more about bower install.

# installs the project dependencies listed in bower.json
bower install
# registered package
bower install jquery
# GitHub shorthand
bower install desandro/masonry
# Git endpoint
bower install git://github.com/user/package.git
# URL
bower install http://example.com/script.js

?

Search packages

Search Bower packages and find the registered package names for your favorite projects.

Save packages

Create a bower.json file for your package with bower init.

Then save new dependencies to your bower.json with bower install PACKAGE --save

Use packages

How you use packages is up to you. We recommend you use Bower together with Grunt, RequireJS, Yeoman, and lots of other tools or build your own workflow with the API. You can also use the installed packages directly, like this, in the case of jquery:

<script src="bower_components/jquery/dist/jquery.min.js"></script>

?

實例

https://libraries.io/bower/blueimp-file-upload

bower install blueimp-file-upload? ? ? ?

?

安裝完成后可以查看版本

https://stedolan.github.io/jq/

https://shapeshed.com/jq-json/#how-to-find-a-key-and-value

https://github.com/stedolan/jq/wiki/Installation#windows-with-choco

cat bower_components/blueimp-file-upload/.bower.json | ./jq-win64.exe '.version'
"9.32.0"

?

npm

https://www.npmjs.com/package/blueimp-file-upload

npm i blueimp-file-upload

?

?

Bye, bye, Bower! Or how to migrate from Bower to npm and Webpack

Bower is going away. Even the bower team is recommending developers to move over to npm (or Yarn which I personally prefer) and Webpack. As one can see from the screenshot, we get the following warning when running npm i bower from cli.

?

?

?

Difference between Grunt, NPM and Bower ( package.json vs bower.json )

?

Update for mid 2016:

The things are changing so fast that if it's late 2017 this answer might not be up to date anymore!

Beginners can quickly get lost in choice of build tools and workflows, but what's most up to date in 2016 is not using Bower, Grunt or Gulp at all! With help of Webpack you can do everything directly in NPM!

  • Google "npm as build tool" result: https://medium.com/@dabit3/introduction-to-using-npm-as-a-build-tool-b41076f488b0#.c33e74tsa

  • Webpack: https://webpack.github.io/docs/installation.html

Don't get me wrong people use other workflows and I still use GULP in my legacy project(but slowly moving out of it), but this is how it's done in the best companies and developers working in this workflow make a LOT of money!

Look at this template it's a very up-to-date setup consisting of a mixture of the best and the latest technologies: https://github.com/coryhouse/react-slingshot

  • Webpack
  • NPM as a build tool (no Gulp, Grunt or Bower)
  • React with Redux
  • ESLint
  • the list is long. Go and explore!

Your questions:

When I want to add a package (and check in the dependency into git), where does it belong - into package.json or into bower.json

  • Everything belongs in package.json now

  • Dependencies required for build are in "devDependencies" i.e. npm install require-dir --save-dev (--save-dev updates your package.json by adding an entry to devDependencies)

  • Dependencies required for your application during runtime are in "dependencies" i.e. npm install lodash --save (--save updates your package.json by adding an entry to dependencies)

If that is the case, when should I ever install packages explicitly like that without adding them to the file that manages dependencies (apart from installing command line tools globally)?

Always. Just because of comfort. When you add a flag (--save-dev or --save) the file that manages deps (package.json) gets updated automatically. Don't waste time by editing dependencies in it manually. Shortcut for npm install --save-dev package-name is npm i -D package-name and shortcut for npm install --save package-name is npm i -S package-name

?

轉載于:https://www.cnblogs.com/chucklu/p/11081138.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/248656.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/248656.shtml
英文地址,請注明出處:http://en.pswp.cn/news/248656.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Python 常用系統模塊整理

Python中的常用的系統模塊中部分函數等的整理 random: 隨機數sys: 系統相關os: 系統相關的subprocess: 執行新的進程multiprocessing: 進程相關threading: 線程相關pickle: 將對象轉換成二進制文件time: 時間datetime: 基本的日期和時間類型timeit: 準確測量小段代碼的執行時間…

PHP從零開始--字段修飾符數據操作SQL語言

文章目錄一、 字段修飾符1.1主鍵1.2自動增長1.3非空1.4默認值1.5外鍵二、 對數據的操作2.1增加數據2.2刪除數據2.3更新數據2.4查詢數據2.4.1查詢所有的數據2.4.2查詢指定字段2.4.3去除重復字段2.4.4where表達式詳解2.4.5分組查詢2.4.6排序三、 SQL語言3.1DML3.2DDL3.3DCL一、 字…

scrapy爬蟲框架windows下的安裝問題

windows操作系統python版本是3.6.0通過Anaconda命令conda install scrapy安裝scrapy,安裝過程中沒有問題。然后在命令行輸入命令準備新建項目時&#xff0c;輸入 scrapy startproject firstscrapy時出現了from cryptography.hazmat.bindings._openssl import ffi, libImportErr…

charles使用說明(基于mac)

1. Charles簡介 1.1 Charles 需要java的運行環境支持&#xff0c;支持Windows、Mac&#xff1b;Fiddler不支持Mac。故Charles是在Mac下常用的網絡封包截取工具。 1.2 Charles原理&#xff1a;通過將自己設置成系統的網絡訪問代理服務器&#xff0c;使得所有的網絡訪問請求都通過…

看完就懂的連表查詢

文章目錄一、表與表之間的關系1.1一對一1.2一對多1.3多對多二、 連表查詢2.1概念2.2笛卡爾積2.3內連接2.4外連接2.4.1左外連接2.4.2右外連接2.4.3全連接2.4.4navicat導入導成sql語句2.4.5練習三、 子查詢3.1概念3.2練習3.2.1查詢工資最高的員工所有信息3.2.2查詢工資比7654工資…

jpa

Transactionalpublic void testPerson() {try {Person person1 personDao.findById(1);person1.setAddress("天津");} catch (Exception e) {e.printStackTrace();}} service就這樣一個方法&#xff0c;數據庫中數據也會進行更新 將查詢出來的數據對象賦值,然后不執…

影視感悟專題---1、B站-魔獸世界代理及其它亂七八糟

影視感悟專題---1、B站-魔獸世界代理及其它亂七八糟 一、總結 一句話總結&#xff1a; 看過的東西都可以學下&#xff0c;這樣既可以學習那些東西&#xff0c;都是對自己生活學習有幫助的&#xff0c;還可以彌補自己每天學的東西的不夠 1、《美麗心靈》中的博弈論共贏理論指的啥…

三分鐘掌握PHP操作數據庫

這里寫自定義目錄標題一、 操作數據庫&#xff08;mysql&#xff09;的工具1.1命令行工具1.2navicat界面化工具1.3phpAdmin界面化工具二、 表單傳值2.1文本框和文本域傳值2.2單選框傳值2.4下拉菜單傳值三、 php連接數據庫3.1連接方式介紹3.2mysqli基礎步驟3.2.1創建連接3.2.2選…

go語言之進階篇主協程先退出導致子協程沒來得及調用

1、主協程先退出導致子協程沒來得及調用 示例&#xff1a; package mainimport ("fmt""time" )//主協程退出了&#xff0c;其它子協程也要跟著退出 func main() {go func() {i : 0for {ifmt.Println("子協程 i ", i)time.Sleep(time.Second)}}(…

Actor模型(分布式編程)

Actor的目的是為了解決分布式編程中的一系列問題。所有消息都是異步交付的&#xff0c;因此將消息發送方與接收方分開&#xff0c;正是由于這種分離&#xff0c;導致actor系統具有內在的并發性&#xff1a;可以不受限制地并行執行任何擁有輸入消息的 actor。用Actor寫的程序可以…

看完就會的文件編程

文章目錄文件編程1.1文件操作函數1.1.1file()函數1.1.2fopen fgets fclose1.2.1讀取模式1.2.2寫入內容&#xff08;開頭&#xff09;1.2.3寫入內容&#xff08;追加&#xff09;1.1.3file_get_contents1.1.4文件路徑相關函數1.1.5file_exists1.1.6feof1.1.7copy()1.1.8set_incl…

Redis主從同步

主從同步原理 1. 從服務器向主服務器發送 SYNC 命令。2. 接到 SYNC 命令的主服務器會調用BGSAVE 命令&#xff0c;創建一個 RDB 文件&#xff0c;并使用緩沖區記錄接下來執行的所有寫命令。3. 當主服務器執行完 BGSAVE 命令時&#xff0c;它會向從服務器發送 RDB 文件&#xff…

BigDecimal轉String,int,double及簡單操作運算、方法

---恢復內容開始---1.字符型數據&#xff1a;char\varchar\text這幾種數據類型都是用來裝字符串的char 固定長度存儲數據varcahr 按變長存儲數據text 當你需要存儲非常大量的字符串時使用nchar、nvarchar、ntext這幾個也是存儲字符串的&#xff0c;與上面的對應相同。唯一不同的…

一文吃透PHP和HTML的嵌套寫法

1.1全部php生成結構 1.2html中嵌套php 總結如下&#xff1a; html和php混寫規則&#xff1a; php代碼必須包在<?php ?>html中寫php也是同理&#xff0c;但是有值輸出必須加上echo 1.3博客項目 1.3.1前后臺 前臺主要是做數據展示的&#xff0c;所有的用戶通過訪問域…

hello.cpp 第一個C++程序(本博客沒有特指都是以QT測試)

操作步驟&#xff1a;1.文件->新建文件或項目(N)->New File or Project->Qt Console Application->Choose->“名稱”中輸入工程名稱->“創建路徑”中輸入保存位置->下一步->選擇“工具包”->下一步->完成。 1.新標準 1 #include <iostream>…

一文看懂 GD2庫

文章目錄一、 GD2簡介1、 驗證碼&#xff08;實際上是一個img&#xff09;二、 GD2庫使用步驟2.1添加擴展2.2修改php配置文件2.3重啟服務三、 GD2里面的常用方法3.1 imagecreate3.2 imagecolorallocate3.3 imagefill3.4 輸出圖像資源3.5創建真彩畫布3.6在圖像中寫文字3.6.1imag…

算法實踐--最小生成樹(Kruskal算法)

什么是最小生成樹(Minimum Spanning Tree) 每兩個端點之間的邊都有一個權重值&#xff0c;最小生成樹是這些邊的一個子集。這些邊可以將所有端點連到一起&#xff0c;且總的權重最小 下圖所示的例子&#xff0c;最小生成樹是{cf, fa, ab} 3條邊 Kruskal算法 用到上一篇中介紹的…

洽談 “會話技術” 純干貨趕緊收藏吧

文章目錄一、 HTTP協議二、 會話三、 cookie3.1概念和設置cookie3.2讀取cookie3.3設置cookie有效期3.4cookie是跨頁面的3.5刪除cookie3.6登錄案例3.7cookie特點四、 session4.1概念4.2設置session4.3獲取session4.4清除session4.5模擬購物車案例一、 HTTP協議 HTTP協議是Hyper…

[bzoj2729][HNOI2012]排隊 題解 (排列組合 高精)

Description 某中學有 n 名男同學&#xff0c;m 名女同學和兩名老師要排隊參加體檢。他們排成一條直線&#xff0c;并且任意兩名女同學不能相鄰&#xff0c;兩名老師也不能相鄰&#xff0c;那么一共有多少種排法呢&#xff1f;&#xff08;注意&#xff1a;任意兩個人都是不同的…

詳解 正則表達式

文章目錄一、概念二、作用三、語法規則3.1定義規則3.2符號簡介3.3preg_match用法詳解3.4詳解元字符3.4.1 \d和[0-9]3.4.2 \D和[^0-9]3.4.3^和$3.4.4*代表出現0次或者多次3.4.5代表出現1次或者多次3.4.5&#xff1f;代表出現0次或者1次3.4.6{n}3.4.7{n,}3.4.8{n,m}3.4.9點號&…