Source

Gba lati ayelujara

Ṣe igbasilẹ Bootstrap lati gba CSS ti a kojọpọ ati JavaScript, koodu orisun, tabi pẹlu pẹlu awọn oluṣakoso package ayanfẹ rẹ bii npm, RubyGems, ati diẹ sii.

Akojọ CSS ati JS

Ṣe igbasilẹ koodu ti o ṣetan lati lo fun Bootstrap v4.4.1 lati ni irọrun ju silẹ sinu iṣẹ akanṣe rẹ, eyiti o pẹlu:

  • Iṣakojọpọ ati awọn idii CSS ti o dinku (wo afiwe awọn faili CSS )
  • Iṣakojọpọ ati awọn afikun JavaScript ti o dinku

Eyi ko pẹlu iwe, awọn faili orisun, tabi eyikeyi awọn igbẹkẹle JavaScript yiyan (jQuery ati Popper.js).

Gba lati ayelujara

Awọn faili orisun

Ṣe akopọ Bootstrap pẹlu opo gigun ti epo dukia tirẹ nipa gbigba orisun Sass wa, JavaScript, ati awọn faili iwe. Aṣayan yii nilo awọn irinṣẹ afikun:

  • Alakojo Sass (Libsass tabi Ruby Sass ni atilẹyin) fun ṣiṣe akojọpọ CSS rẹ.
  • Autoprefixer fun CSS olùtajà ìpele

Ti o ba nilo awọn irinṣẹ kikọ , wọn wa pẹlu idagbasoke Bootstrap ati awọn iwe aṣẹ rẹ, ṣugbọn wọn ṣee ṣe ko yẹ fun awọn idi tirẹ.

Download orisun

jsDelivr

Rekọja igbasilẹ pẹlu jsDelivr lati ṣafipamọ ẹya cache ti Bootstrap's CSS ti a ṣajọpọ ati JS si iṣẹ akanṣe rẹ.

<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>

Ti o ba nlo JavaScript ti a ṣe akojọpọ, maṣe gbagbe lati ni awọn ẹya CDN ti jQuery ati Popper.js ṣaaju ki o to.

<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>

Package alakoso

Fa awọn faili orisun Bootstrap sinu fere eyikeyi iṣẹ akanṣe pẹlu diẹ ninu awọn oluṣakoso package olokiki julọ. Laibikita oluṣakoso package, Bootstrap yoo nilo olupilẹṣẹ Sass kan ati Autoprefixer fun iṣeto ti o baamu awọn ẹya ti a ṣajọpọ osise wa.

npm

Fi Bootstrap sori ẹrọ ni awọn ohun elo agbara Node.js rẹ pẹlu package npm :

npm install bootstrap

require('bootstrap')yoo gbe gbogbo awọn afikun jQuery Bootstrap sori ohun jQuery. Awọn bootstrapmodule ara ko ni okeere ohunkohun. O le fi ọwọ gbe awọn afikun jQuery Bootstrap lọkọọkan nipasẹ ikojọpọ awọn /js/*.jsfaili labẹ itọsọna ipele oke ti package.

Bootstrap's package.jsonni diẹ ninu awọn afikun metadata labẹ awọn bọtini wọnyi:

  • sass- ọna si faili orisun Sass akọkọ Bootstrap
  • style- ọna si Bootstrap ti kii ṣe minimini CSS ti o ti ṣajọ tẹlẹ nipa lilo awọn eto aiyipada (ko si isọdi)

owu

Fi Bootstrap sori ẹrọ ni awọn ohun elo agbara Node.js rẹ pẹlu package owu :

yarn add bootstrap

RubyGems

Fi Bootstrap sori awọn ohun elo Ruby rẹ nipa lilo Bundler ( ti a ṣe iṣeduro ) ati RubyGems nipa fifi laini atẹle si rẹ Gemfile:

gem 'bootstrap', '~> 4.4.1'

Ni omiiran, ti o ko ba lo Bundler, o le fi fadaka sii nipa ṣiṣe aṣẹ yii:

gem install bootstrap -v 4.4.1

Wo olowoiyebiye's README fun awọn alaye siwaju sii.

Olupilẹṣẹ

O tun le fi sori ẹrọ ati ṣakoso Bootstrap's Sass ati JavaScript nipa lilo Olupilẹṣẹ :

composer require twbs/bootstrap:4.4.1

NuGet

Ti o ba dagbasoke ni .NET, o tun le fi sii ati ṣakoso Bootstrap's CSS tabi Sass ati JavaScript nipa lilo NuGet :

Install-Package bootstrap
Install-Package bootstrap.sass