Du tɛrɛn
Aw ye Bootstrap doncogo dɔn aw ka porozɛ kɔnɔ ni Parcel ye.
A’ ye Parcelle sigi sen kan
Aw bɛ Parsela Bundler sigi sen kan .
Bootstrap sigi sen kan
Bootstrap sigi sen kan i n’a fɔ Node.js modulu ni npm ye.
Bootstrap bɛ da Popper kan , o min ɲɛfɔlen don peerDependencies
nafolo kɔnɔ. o kɔrɔ ye ko aw bɛna aw jija k' u fila bɛɛ fara aw ka package.json
baarakɛcogo npm install @popperjs/core
kan .
Ni bɛɛ bɛna ban, i ka porozɛ bɛna labɛn nin cogo la:
project-name/
├── build/
├── node_modules/
│ └── bootstrap/
│ └── popper.js/
├── scss/
│ └── custom.scss
├── src/
│ └── index.html
│ └── index.js
└── package.json
JavaScript min bɛ don jamana kɔnɔ
Bootstrap ka JavaScript don i ka app don yɔrɔ la (a ka c’a la src/index.js
). Aw bɛ se k’an ka fɛnɲɛnɛmaw bɛɛ Ladon dosiye kelen kɔnɔ walima u danma n’aw b’u ka kulu fitinin dɔrɔn de wajibiya.
// 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';
CSS min bɛ don jamana kɔnɔ
Walasa ka baara kɛ ni Bootstrap seko bɛɛ ye ani k’a kɛ ka kɛɲɛ n’i magow ye, baara kɛ ni source files ye i n’a fɔ i ka poroze ka bundling process dɔ.
Aw ye aw yɛrɛ ta dabɔ scss/custom.scss
walasa ka Bootstrap ka Sass filenw ladon ka sɔrɔ ka ladamu fɛn caman sɛgɛsɛgɛli kɛ .
A’ ye appli (application) jɔ
Aw bɛ a don src/index.js
a kɔnɔ sani aw ka dadon </body>
taamasiyɛn kɛ.
<!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>
Ka korizepackage.json
Fàra dev
ni build
sɛbɛnniw ye i ka package.json
dosiye kɔnɔ.
"scripts": {
"dev": "parcel ./src/index.html",
"prebuild": "npx rimraf build",
"build": "parcel build --public-url ./ ./src/index.html --experimental-scope-hoisting --out-dir build"
}
Boli dev script ye
Aw ka app bɛna sɔrɔ yɔrɔ la http://127.0.0.1:1234
.
npm run dev
A’ ye app filew jɔ
Filenw jɔlenw bɛ build/
foli kɔnɔ.
npm run build