Webpack
Funda indlela yokubandakanya iBootstrap kwiprojekthi yakho usebenzisa iWebpack.
Ukufakela i-Bootstrap
Faka i-bootstrap njengemodyuli ye-Node.js usebenzisa i-npm.
Ukuthathwa ngaphandle kweJavaScript
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 kwijQuery kunye nePopper , echazwe peerDependencies
kwipropati; oku kuthetha ukuba kuya kufuneka uqiniseke ukuba uzongeza zombini ekusebenziseni package.json
kwakho npm install --save jquery popper.js
.
Ukungenisa Izimbo
Ukungeniswa ngaphandle kweSass eQinisekisiweyo
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 ihlanganise, qiniseka ukuba ufaka kwaye usebenzise abalayishi abafunekayo: i-sass-loader , i-postcss-loader nge - Autoprefixer . Ngokucwangciswa okuncinci, uqwalaselo lwakho lwewebhu kufuneka lubandakanye lo mgaqo okanye okufanayo:
Ukuthathwa ngaphandle kwe-CSS ehlanganisiweyo
Kungenjalo, unokusebenzisa 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 .