Parcel
Dzidza maitiro ekusanganisa Bootstrap mupurojekiti yako uchishandisa Parcel.
Isa Parcel
Isa Parcel Bundler .
Isa Bootstrap
Isa bootstrap seNode.js module uchishandisa npm.
Bootstrap inoenderana nePopper , iyo inotsanangurwa peerDependencies
mumudziyo. Izvi zvinoreva kuti iwe uchafanirwa kuve nechokwadi chekuwedzera ese ari maviri package.json
pakushandisa kwako npm install @popperjs/core
.
Kana zvese zvapera, purojekiti yako ichagadziriswa seizvi:
project-name/
├── build/
├── node_modules/
│ └── bootstrap/
│ └── popper.js/
├── scss/
│ └── custom.scss
├── src/
│ └── index.html
│ └── index.js
└── package.json
Kupinza JavaScript
Ngenisa Bootstrap's JavaScript munzvimbo yekupinda yeapp yako (kazhinji src/index.js
). Iwe unogona kuunza edu ese maplugins mufaira rimwe kana zvakasiyana kana iwe uchingoda chete subset yavo.
// 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';
Kutora kunze CSS
Kuti ushandise iyo yakazara mukana weBootstrap uye kuigadzirisa kune zvaunoda, shandisa iyo sosi mafaera sechikamu chechirongwa chako chekuunganidza.
Gadzira yako scss/custom.scss
kupinza maBootstrap's Sass mafaera uye wobva wapfuura akavakirwa-mukati etsika akasiyana .
Vaka app
Sanganisira src/index.js
pamberi pekuvhara </body>
tag.
<!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>
Editpackage.json
Wedzera dev
uye build
zvinyorwa package.json
mufaira rako.
"scripts": {
"dev": "parcel ./src/index.html",
"prebuild": "npx rimraf build",
"build": "parcel build --public-url ./ ./src/index.html --experimental-scope-hoisting --out-dir build"
}
Mhanya dev script
App yako ichawanikwa pa http://127.0.0.1:1234
.
npm run dev
Gadzira mafaera eapp
Mafaira akavakirwa ari build/
mufolda.
npm run build