Source

Hoʻoiho

Hoʻoiho iā Bootstrap e kiʻi i ka CSS i hui ʻia a me JavaScript, kumu kumu, a i ʻole e hoʻokomo pū me kāu mau pūʻulu punahele punahele e like me npm, RubyGems, a me nā mea hou aku.

CSS a me JS i houluuluia

Hoʻoiho i ke code i hoʻohui ʻia no Bootstrap v4.4.1 e hoʻokuʻu maʻalahi i kāu papahana, ʻo ia hoʻi:

ʻAʻole pili kēia i nā palapala, nā waihona kumu, a i ʻole nā ​​mea hilinaʻi JavaScript koho (jQuery a me Popper.js).

Hoʻoiho

Nā waihona kumu

Hoʻopili i ka Bootstrap me kāu pipeline waiwai ponoʻī ma ka hoʻoiho ʻana i kā mākou kumu Sass, JavaScript, a me nā faila palapala. Pono kēia koho i kekahi mau mea hana hou:

  • Sass compiler (Libsass a i ʻole Ruby Sass i kākoʻo ʻia) no ka hōʻuluʻulu ʻana i kāu CSS.
  • Autoprefixer no ka CSS mea kūʻai prefixing

Inā makemake ʻoe e kūkulu i nā mea hana , ua hoʻokomo ʻia lākou no ka hoʻomohala ʻana iā Bootstrap a me kāna mau palapala, akā ʻaʻole kūpono lākou no kāu mau kumu ponoʻī.

Hoʻoiho i ke kumu

jsDelivr

Hoʻokuʻu i ka hoʻoiho ʻana me jsDelivr e hāʻawi i ka mana huna o kā Bootstrap CSS a me JS i hui pū ʻia i kāu papahana.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

Inā ʻoe e hoʻohana nei i kā mākou JavaScript i hōʻuluʻulu ʻia, mai poina e hoʻokomo i nā mana CDN o jQuery a me Popper.js ma mua o ia.

<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>

Nā luna pūʻolo

Huki i nā faila kumu o Bootstrap i loko o kahi papahana me kekahi o nā mana hoʻokele kaulana loa. ʻAʻole pili i ka luna pūʻolo, e koi ʻo Bootstrap i kahi Sass compiler a me Autoprefixer no kahi hoʻonohonoho e kūlike i kā mākou mau mana i hōʻuluʻulu ʻia.

npm

E hoʻouka i ka Bootstrap i kāu mau polokalamu mana Node.js me ka pūʻolo npm :

npm install bootstrap

require('bootstrap')e hoʻouka i nā plugins jQuery a pau o Bootstrap i ka mea jQuery. bootstrapʻAʻole hoʻokuke aku ka module i kekahi mea . Hiki iā ʻoe ke hoʻouka lima i nā plugins jQuery o Bootstrap i kēlā me kēia ma ka hoʻouka ʻana i nā /js/*.jsfaila ma lalo o ka papa kuhikuhi kiʻekiʻe o ka pūʻolo.

Aia i loko o Bootstrap package.jsonkekahi mau metadata hou ma lalo o nā kī aʻe:

  • sass- ala i ka waihona kumu Sass nui o Bootstrap
  • style- ke ala i ka CSS non-minified o Bootstrap i hoʻonohonoho mua ʻia me ka hoʻohana ʻana i nā hoʻonohonoho paʻamau (ʻaʻohe hana maʻamau)

wili

E hoʻouka i ka Bootstrap i kāu mau polokalamu mana Node.js me ka pūʻolo yarn :

yarn add bootstrap

RubyGems

E hoʻouka i ka Bootstrap i kāu mau polokalamu Ruby me ka hoʻohana ʻana iā Bundler ( manaʻo ʻia ) a me RubyGems ma ka hoʻohui ʻana i kēia laina i kāu Gemfile:

gem 'bootstrap', '~> 4.4.1'

ʻO kahi ʻē aʻe, inā ʻaʻole ʻoe e hoʻohana iā Bundler, hiki iā ʻoe ke hoʻokomo i ka gem ma ka holo ʻana i kēia kauoha:

gem install bootstrap -v 4.4.1

E ʻike i ka README o ka gem no nā kikoʻī hou aku.

Mea haku mele

Hiki iā ʻoe ke hoʻouka a hoʻokele i kā Bootstrap's Sass a me JavaScript me ka hoʻohana ʻana i ka Composer :

composer require twbs/bootstrap:4.4.1

NuGet

Inā hoʻomohala ʻoe ma .NET, hiki iā ʻoe ke hoʻouka a mālama i kā Bootstrap CSS a i ʻole Sass a me JavaScript me ka hoʻohana ʻana iā NuGet :

Install-Package bootstrap
Install-Package bootstrap.sass