Baasa
Yiga engeri y'okussaamu Bootstrap mu pulojekiti yo ng'okozesa Parcel.
Teekamu Parcel
Teekamu Parcel Bundler .
Teeka mu nkola ya Bootstrap
Teeka bootstrap nga module ya Node.js nga okozesa npm.
Bootstrap esinziira ku Popper , eragiddwa mu peerDependencies
kintu. Kino kitegeeza nti ojja kuba olina okukakasa nti byombi obigatta ku package.json
nkozesa yo npm install @popperjs/core
.
Byonna bwe binaaggwa, pulojekiti yo ejja kusengekebwa bweti:
project-name/
├── build/
├── node_modules/
│ └── bootstrap/
│ └── popper.js/
├── scss/
│ └── custom.scss
├── src/
│ └── index.html
│ └── index.js
└── package.json
Okuyingiza JavaScript
Yingiza JavaScript ya Bootstrap mu kifo app yo w'eyingira (ebiseera ebisinga src/index.js
). Osobola okuyingiza plugins zaffe zonna mu file emu oba okwawukana singa oba weetaaga subset yokka ku zo.
// 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';
Okuyingiza CSS
Okukozesa obusobozi bwonna obwa Bootstrap n’okubulongoosa okusinziira ku byetaago byo, kozesa fayiro z’ensibuko ng’ekitundu ku nkola ya pulojekiti yo ey’okugatta.
Tonda eyiyo scss/custom.scss
okuyingiza fayiro za Sass eza Bootstrap n'oluvannyuma okyuse enkyukakyuka ez'ennono ezizimbibwamu .
Zimba app
Muteekemu nga tonnaba kussaako tag src/index.js
y’okuggalawo .</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>
Okugololapackage.json
Okwongerako dev
ne build
scripts mu package.json
fayiro yo.
"scripts": {
"dev": "parcel ./src/index.html",
"prebuild": "npx rimraf build",
"build": "parcel build --public-url ./ ./src/index.html --experimental-scope-hoisting --out-dir build"
}
Kozesa ekiwandiiko kya dev
App yo ejja kuba efunibwa ku http://127.0.0.1:1234
.
npm run dev
Zimba fayiro za app
Fayiro ezizimbibwa ziri mu build/
folda.
npm run build