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
.
Rịba ama na ọ bụrụ na ị họọrọ ibubata plugins n'otu n'otu , ị ga-etinyerịrị mbupụ-loader
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 faịlụ sass isi 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 ma ọ bụrụ na ịchọghị sass-loader
naanị ụdị-loader na css-loader .