Urubuga
Wige uburyo washyira Bootstrap mumushinga wawe ukoresheje Webpack 3.
Shyiramo bootstrap nka Node.js module ukoresheje npm.
Kuzana JavaScript ya Bootstrap wongeyeho uyu murongo aho porogaramu yawe yinjira (mubisanzwe index.js
cyangwa app.js
):
Ubundi, urashobora gutumiza amacomeka kugiti cye nkuko bikenewe:
Bootstrap iterwa na jQuery na Popper , ibi bisobanuwe nk peerDependencies
, ibi bivuze ko ugomba gukora ibishoboka byose kugirango wongere byombi mubyo package.json
ukoresha npm install --save jquery popper.js
.
Menya ko niba wahisemo gutumiza amacomeka kugiti cyawe , ugomba no gushiraho ibicuruzwa byohereza hanze
Kugirango wishimire ubushobozi bwuzuye bwa Bootstrap kandi uyitondere kubyo ukeneye, koresha dosiye yinkomoko nkigice cyumushinga wawe uhuza.
Ubwa mbere, kora ibyawe _custom.scss
kandi ubikoreshe kugirango uhishe ibyubatswe muburyo bwihariye . Noneho, koresha dosiye yawe nyamukuru ya sass kugirango utumize ibintu byahinduwe, hanyuma ukurikire Bootstrap:
Kugirango Bootstrap ikusanye, menya neza ko ushyiraho kandi ukoreshe ibikenerwa bisabwa: sass-umutware , postcss- umutware hamwe na Autoprefixer . Hamwe nimikorere mike, webpack config yawe igomba gushyiramo iri tegeko cyangwa bisa:
Ubundi, urashobora gukoresha Bootstrap yiteguye-gukoresha-css wongeyeho uyu murongo aho umushinga wawe winjirira:
Muri iki kibazo, ushobora gukoresha amategeko yawe asanzweho css
nta gihindutse kidasanzwe kuri webpack config usibye ko udakeneye sass-loader
gusa imiterere-umutwaro na css-umutwaro .