Akpa webụ
Mụta otu esi etinye Bootstrap n'ọrụ gị site na iji Webpack 3.
Wụnye bootstrap dị ka modul Node.js site na iji npm.
Bubata JavaScript nke Bootstrap site na ịgbakwunye ahịrị a na ntinye ngwa gị (na-emekarị index.js
ma ọ bụ app.js
):
N'aka nke ọzọ, ịnwere ike ibubata plugins n'otu n'otu dịka achọrọ:
Bootstrap na-adabere na jQuery na Popper , a na-akọwa ihe ndị a dị ka peerDependencies
, nke a pụtara na ị ga-ahụrịrị ịgbakwunye ha abụọ na iji package.json
gị npm install --save jquery popper.js
.
Iji kporie ndụ zuru oke nke Bootstrap ma hazie ya ka ọ bụrụ mkpa gị, jiri faịlụ isi mmalite dịka akụkụ nke usoro nchịkọta ọrụ gị.
Nke mbụ, mepụta nke gị _custom.scss
wee jiri ya kagbuo ụdị mgbanwe omenala arụnyere n'ime ya . Mgbe ahụ, jiri isi faịlụ Sass gị bubata mgbanwe omenala gị, Bootstrap sochiri ya:
Maka Bootstrap iji chịkọta, jide n'aka na ị wụnye ma jiri ihe ndị a chọrọ: sass-loader , postcss-loader with Autoprefixer . Site na nhazi ntakịrị, nhazi akpa weebụ gị kwesịrị ịgụnye iwu a ma ọ bụ ihe yiri ya:
N'aka nke ọzọ, ịnwere ike iji CSS dị njikere iji Bootstrap site na ịgbakwunye ahịrị a na ntinye ọrụ gị:
N'okwu a, ịnwere ike iji iwu gị dị ugbu a na- css
enweghị mgbanwe ọ bụla na nhazi webpack, belụsọ na ịchọghị sass-loader
naanị ụdị-loader na css-loader .