Parcel
Disce quomodo includendi Bootstrap in project usura Parcel.
install Parcel
Install Parcel Fasciculus .
install Bootstrap
Install bootstrap ut Node.js moduli utens npm.
Bootstrap pendet a Popper , quod in peerDependencies
proprietate specificatur . Id quod habebis fac ut utrumque addas ad package.json
usum tuum npm install @popperjs/core
.
Cum omnia complebuntur, consilium tuum sic structum erit;
project-name/
├── build/
├── node_modules/
│ └── bootstrap/
│ └── popper.js/
├── scss/
│ └── custom.scss
├── src/
│ └── index.html
│ └── index.js
└── package.json
Importat JavaScript
Import Bootstrap's JavaScript in your app's entry point (solet src/index.js
). Omnia plugins nostra in uno fasciculo vel divisim importare potes si tantum partem ex eis exigis.
// 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';
Importat CSS
Ad plenam potentiam Bootstrap utendum et ad necessitates tuas customize, lima fonte utere ut parte processus fasciculi propositi tui.
Tuam propriam crea in scss/custom.scss
Bootstrap limas Sass importare et deinde variabiles consuetudines constructas vincire .
Ædificate app
Includit src/index.js
ante occlusionem </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>
Editpackage.json
Adde dev
et build
scripta in tabella tua package.json
.
"scripts": {
"dev": "parcel ./src/index.html",
"prebuild": "npx rimraf build",
"build": "parcel build --public-url ./ ./src/index.html --experimental-scope-hoisting --out-dir build"
}
Curre dev script
Your app will be accessible at http://127.0.0.1:1234
.
npm run dev
Aedificare app files
Tabulae aedificatae sunt in build/
folder.
npm run build