Webpack
Phunzirani momwe mungaphatikizire Bootstrap mu polojekiti yanu pogwiritsa ntchito Webpack 3.
Ikani bootstrap ngati gawo la Node.js pogwiritsa ntchito npm.
Lowetsani JavaScript ya Bootstrap powonjezera mzerewu kumalo olowera pulogalamu yanu (nthawi zambiri index.js
kapena app.js
):
Kapenanso, mutha kulowetsa mapulagini payekhapayekha ngati pakufunika:
Bootstrap imadalira jQuery ndi Popper , izi zimatanthauzidwa ngati peerDependencies
, izi zikutanthauza kuti muyenera kuonetsetsa kuti mwawonjezera zonse pakugwiritsa ntchito package.json
kwanu npm install --save jquery popper.js
.
Zindikirani kuti ngati mwasankha kulowetsa mapulagini payekhapayekha , muyeneranso kukhazikitsa exports-loader
Kuti musangalale ndi kuthekera konse kwa Bootstrap ndikusintha makonda anu kuti agwirizane ndi zosowa zanu, gwiritsani ntchito mafayilo oyambira ngati gawo lakusanjikiza kwa polojekiti yanu.
Choyamba, pangani zanu ndikuzigwiritsa _custom.scss
ntchito kuti muwongolere zosintha zomwe zakhazikitsidwa . Kenako, gwiritsani ntchito fayilo yanu yayikulu ya sass kuti mulowetse zosintha zanu, zotsatiridwa ndi Bootstrap:
Kuti Bootstrap isankhidwe, onetsetsani kuti mwayika ndikugwiritsa ntchito zonyamula zofunika: sass-loader , postcss-loader ndi Autoprefixer . Pokhazikitsa pang'ono, kasinthidwe katsamba lanu katsamba kayenera kukhala ndi lamulo ili kapena zofananira:
Kapenanso, mutha kugwiritsa ntchito css yokonzeka kugwiritsa ntchito ya Bootstrap pongowonjezera mzerewu kumalo olowera polojekiti yanu:
Apa mutha kugwiritsa ntchito lamulo lanu lomwe lidalipo css
popanda kusintha kwapadera pakusintha kwapapaketi pokhapokha ngati simukufuna kungoyika sass-loader
style -loader ndi css-loader .