Tlolela ho litaba tsa mantlha Tlolela ho li-docs navigation
in English

Sephutheloana

Ithute ho kenyelletsa Bootstrap morerong oa hau u sebelisa Parcel.

Kenya Parcel

Kenya Parcel Bundler .

Kenya Bootstrap

Kenya bootstrap joalo ka mojule oa Node.js u sebelisa npm.

Bootstrap e itšetlehile ka Popper , e boletsoeng peerDependenciessetšeng. Sena se bolela hore o tla tlameha ho etsa bonnete ba hore o li eketsa ka bobeli ts'ebelisong ea hau package.jsonea npm install @popperjs/core.

Ha tsohle li phethetsoe, morero oa hau o tla hlophisoa ka tsela ena:

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

E kenya JavaScript

Kenya JavaScript ea Bootstrap sebakeng sa ho kena sa sesebelisoa sa hau (hangata src/index.js). U ka kenya li-plugins tsohle tsa rona faeleng e le 'ngoe kapa ka thoko haeba u hloka karoloana ea tsona feela.

// 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';

Ho kenya CSS kantle

Ho sebelisa bokhoni bo felletseng ba Bootstrap le ho e etsa ho latela litlhoko tsa hau, sebelisa lifaele tsa mohloli e le karolo ea ts'ebetso ea ho kopanya morero oa hau.

Iketsetse ea hau scss/custom.scssho kenya lifaele tsa Sass tsa Bootstrap ebe u feta liphapang tsa tloaelo tse hahelletsoeng .

Haha app

Kenyelletsa src/index.jspele ho </body>tag e koalang.

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

Fetolapackage.json

Kenya devle buildho ngola package.jsonfaeleng ea hau.

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

Kenya dev script

Sesebelisoa sa hau se tla fumaneha ho http://127.0.0.1:1234.

npm run dev

Theha lifaele tsa app

Lifaele tse hahiloeng li ka har'a build/sephutheli.

npm run build