How to introduce Bootstrap in WebpatStrap

Bootstrap is a factual interface standard, standard to the current website, a lot of use. If you can use the Bootstrapcss introduced by WebPack, you can complete the project’s dependencies without having to manually add to HTML.

I originally thought that I was added in the entrance document:

Import ‘bootstrap / dist / css / bootstrapcss’
   

NPM I Bootstrap URL URL-LOADER STYLE-LOADER CSS-Loader –save
   It is actually not as simple as imagined. Many types of font files and vector diagraph files are also included in the CSS file. To introduce it, you must provide the corresponding Loader: 

//WEBPACKCONFIGJS: Module: {‘JS’}, Output: { FileName: ‘bundlejs’}, module: {loadingers: [{test: / \ css $ /, loader: ‘style-loader! css-loader’}, {test: / \ eot (\? v = \ d + \\ D + \\ D +)? $ /, loader: “file”}, {Test: / \ (WOFF | WOFF2) $ /, loader: “URL? prefix = font / & limited = 5000”}, {test: / \ TTF (\? v = \ d + \\ d + \\ d +)? $ /, loader: “URL? LIMIT = 10000 & mimeType = Application / OCTET-stream “}, {test: / \ svg (\? v = \ d + \\ d + \\ d +)? $ /, loader:” URL? Limit = 10000 & mimeType = image / svg + XML
   We use this bit of Bootstrap in the HTML file: 

// Chtml
Home
     WebPack   Open the browser:  Open chtml   See the familiar and familiar interface of BootStrap. 
Introduced jQuery

If you need to use Bootstrap’s JS plug-in, you must first introduce jQuery. A method of reference jQuery is to use WebPack plug-in.

First Install jQuery:


NPM I jQuery

Secondly uses the plug-in to load jQuery, the method is to modify the configuration file of the WebPack, join:

Plugins: [New WebPackProvidePlugin ({$:”jQuery”, jQuery: “jQuery”})]

   
$ (“Body”) append (“
“)

 If success, JQuery is successfully loaded. This way you can load bootstrapjs in the entrance JS file:   
ivport ‘bootstrap / dist / js / bootstrapjs’

 Troubleshooting error  
I did encounter a magical mistake when introducing bootstrap. In the webpack translation, the error in Css-loader, Unknown Word looks. Join the webpackconfigjs file and point to the disconnected directory.
{Test: / \ CSS $ /, include: [PathResolve (__ DIRNAME, “Not_exist_Path”)], Loader: “Style! CSS”}

Original Issue here: https: // GitHubcom / WebPack / CS. I think it is a joke when I see this answer.
  The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.  
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment