Webpack
Funda indlela yokubandakanya iBootstrap kwiprojekthi yakho usebenzisa iWebpack yesi-3.
Faka i-bootstrap njengemodyuli ye-Node.js usebenzisa i-npm.
Ngenisa iJavaScript yeBootstrap ngokongeza lo mgca kwindawo yokungena yosetyenziso (ngesiqhelo index.js
okanye app.js
):
Kungenjalo, ungangenisa ii- plugins nganye nganye njengoko kufuneka:
I-Bootstrap ixhomekeke kwi jQuery kunye ne Popper , ezi zichazwe njenge peerDependencies
, oku kuthetha ukuba kuya kufuneka uqiniseke ukuba udibanise zombini ekusebenziseni package.json
kwakho npm install --save jquery popper.js
.
Ukonwabela amandla apheleleyo eBootstrap kwaye uzenzele ngokweemfuno zakho, sebenzisa iifayile zomthombo njengenxalenye yenkqubo yokudibanisa iprojekthi yakho.
Okokuqala, zenzele eyakho _custom.scss
kwaye uyisebenzise ukodlula izinto eziguquguqukayo ezakhelwe ngaphakathi . Emva koko, sebenzisa ifayile yakho ephambili yeSass ukungenisa izinto eziguquguqukayo zesiko, zilandelwa yiBootstrap:
Ukuze i-Bootstrap iqokelele, qiniseka ukuba ufaka kwaye usebenzise abalayishi abafunekayo: i-sass-loader , i-postcss-loader nge - Autoprefixer . Ngokuseta okuncinci, uqwalaselo lwakho lwepakethi yewebhu kufuneka lubandakanye lo mgaqo okanye okufanayo:
Kungenjalo, ungasebenzisa i-Bootstrap esele ilungele ukusebenzisa i-CSS ngokongeza ngokulula lo mgca kwindawo yokungena yeprojekthi yakho:
Kulo mzekelo ungasebenzisa umthetho wakho osele css
ukho ngaphandle kohlengahlengiso olukhethekileyo kuqwalaselo lwepakethi yewebhu, ngaphandle kokuba awufuni sass-loader
nje isimbo sokulayisha kunye ne -css-loader .