Home  >  Article  >  Web Front-end  >  How to import bootstrap after downloading it with npm

How to import bootstrap after downloading it with npm

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-07-13 10:51:015693browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn