Home >Web Front-end >Bootstrap Tutorial >How to import bootstrap after downloading it with npm
1. The first step, of course, is to use npm to install bootstrap.
npm install bootstrap@4
The function of @4 here is to specify that the installed version is version 4.x. If you don’t write it, the latest version will be installed by default. I still like to write it.
2. Through the previous steps, we have installed bootstrap, and then we need to install jquery, because bootstrap depends on jquery. We also use npm to install jquery.
npm install jquery
Related recommendations: "bootstrap Getting Started Tutorial"
3. Okay, next we will introduce jquery and bootstrap into the file. Let’s create a file first, let’s call it init.js.
import $ from 'jquery'
import 'bootstrap'
4. Next, we need to attach jquery to the window object.
window.jQuery=$
jQuery=$
window.$=window.jQuery
The above is the detailed content of How to import bootstrap after downloading it with npm. For more information, please follow other related articles on the PHP Chinese website!