Parcel

      Learn how to include Bootstrap in your project using Parcel.

      Install Parcel

      Install Parcel Bundler.

      Install Bootstrap

      Install bootstrap as a Node.js module using npm.

      Bootstrap depends on Popper, which is specified in the peerDependencies property. This means that you will have to make sure to add both of them to your package.json using npm install popper.js.

      When all will be completed, your project will be structured like this:

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

      Importing JavaScript

      Import Bootstrap’s JavaScript in your app’s entry point (usually src/index.js). You can import all our plugins in one file or separately if you require only a subset of them.

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

      Importing CSS

      To utilize the full potential of Bootstrap and customize it to your needs, use the source files as a part of your project’s bundling process.

      Create your own scss/custom.scss to import Bootstrap’s Sass files and then override the built-in custom variables.

      Build app

      Include src/index.js before the closing </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>
      

      Edit package.json

      Add dev and build scripts in your package.json file.

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

      Run dev script

      Your app will be accessible at http://127.0.0.1:1234.

      npm run dev
      

      Build app files

      Built files are in the build/ folder.

      npm run build
      
      返回頂部
      主站蜘蛛池模板: 无码av人妻一区二区三区四区| 国产一区二区三区视频在线观看| 中文字幕一区二区免费| 精品一区二区三区高清免费观看| 久久综合一区二区无码| 精品一区二区三区自拍图片区| 亚洲一区在线免费观看| 国产AⅤ精品一区二区三区久久 | 精品一区二区三区中文字幕 | 女同一区二区在线观看| 人妻少妇AV无码一区二区| 91精品一区二区| 国产激情з∠视频一区二区| 国产在线观看精品一区二区三区91 | 国产AV午夜精品一区二区三区| 成人精品视频一区二区三区尤物 | 在线观看中文字幕一区| 呦系列视频一区二区三区| 一区二区三区福利| 四虎永久在线精品免费一区二区 | 任你躁国语自产一区在| 中文乱码精品一区二区三区| 国产成人一区二区三区电影网站| 亚洲AV成人一区二区三区AV| 国产激情无码一区二区三区| 精品视频一区二区观看| 国产精品亚洲一区二区在线观看| 久久久无码一区二区三区| 亚洲国产国产综合一区首页| 亚洲一区免费观看| 麻豆AV一区二区三区| 亚洲国产一区二区三区在线观看| 中文字幕一区二区三区久久网站| 日产亚洲一区二区三区| 无码国产精品一区二区免费式直播 | 日韩精品国产一区| 国产精品亚洲综合一区| 国产凹凸在线一区二区| 国产剧情国产精品一区| 无码一区二区三区在线观看| 精品人妻系列无码一区二区三区 |