Tlolela go diteng tše kgolo Tlolela go docs navigation
in English

Phasela

Ithute ka moo o ka akaretšago Bootstrap mo protšekeng ya gago o diriša Parcel.

Tsenya Sephuthelwana

Tsenya Sephuthedi sa Diphuthelwana .

Kenya Bootstrap

Tsenya bootstrap bjalo ka modula wa Node.js o diriša npm.

Bootstrap itšetlehile ka Popper , e leng e boletsoeng ka peerDependenciesthepa. Se se ra gore o tla swanelwa ke go kgonthiša gore o di oketša ka bobedi go package.jsontšhomišo ya gago npm install @popperjs/core.

Ge ka moka di tla phethwa, projeke ya gago e tla rulaganywa ka tsela ye:

project-name/
├── build/
├── node_modules/
│   └── bootstrap/
│   └── popper.js/
├── scss/
│   └── custom.scss
├── src/
│   └── index.html
│   └── index.js
└── package.json

Go tsenya JavaScript ka ntle

Tsenya JavaScript ya Bootstrap ntlheng ya go tsena ya tirišo ya gago (gantši src/index.js). O ka tsenya di-plugin tša rena ka moka ka gare ga faele e tee goba ka thoko ge e ba o nyaka feela sehlopha se senyenyane sa tšona.

// Import all plugins
import * as bootstrap from 'bootstrap';

// Or import only needed plugins
import { Tooltip as Tooltip, Toast as Toast, Popover as Popover } from 'bootstrap';

// Or import just one
import Alert as Alert from '../node_modules/bootstrap/js/dist/alert';

Go tsenya CSS ka ntle

Go diriša bokgoni bjo bo tletšego bja Bootstrap le go e tlwaetša go ya ka dinyakwa tša gago, diriša difaele tša mohlodi bjalo ka karolo ya tshepedišo ya go kgoboketša ya projeke ya gago.

Hlama ya gago scss/custom.scssgo tsenya ka ntle difaele tša Sass tša Bootstrap gomme ka morago o tloše diphetogo tša tlwaelo tše di agetšwego ka gare .

Aga tirišo

Akaretša pele ga leswao la src/index.jsgo tswalela .</body>

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <script src="./index.js"></script>
  </body>
</html>

Rulaganyapackage.json

Oketša devle builddingwalwa ka package.jsonfaeleng ya gago.

"scripts": {
  "dev": "parcel ./src/index.html",
  "prebuild": "npx rimraf build",
  "build": "parcel build --public-url ./ ./src/index.html --experimental-scope-hoisting --out-dir build"
}

Matha sengwalwa sa dev

Tirišo ya gago e tla fihlelelwa go http://127.0.0.1:1234.

npm run dev

Aga difaele tša tirišo

Hahiloeng difaele ba ka build/foldara.

npm run build