Webpack
Ithute ho kenyelletsa Bootstrap morerong oa hau u sebelisa Webpack 3.
Kenya bootstrap joalo ka mojule oa Node.js u sebelisa npm.
Kenya JavaScript ea Bootstrap ka ho kenya mohala ona moo u kenang teng (hangata index.js
kapa app.js
):
Ntle le moo, o ka kenya li-plugins ka bonngoe ha ho hlokahala:
Bootstrap e itšetlehile ka jQuery le Popper , tsena li hlalosoa e le peerDependencies
, sena se bolela hore u tla tlameha ho etsa bonnete ba hore u li kenya ka bobeli package.json
tšebelisong ea hau npm install --save jquery popper.js
.
Ho natefeloa ke bokhoni bo felletseng ba Bootstrap le ho e etsa ho latela litlhoko tsa hau, sebelisa lifaele tsa mohloli e le karolo ea ts'ebetso ea ho kopanya morero oa hau.
Ntlha ea pele, iketsetse ea hau ' _custom.scss
me u e sebelise ho fetisa mefuta e sa tšoaneng ea tloaelo e hahiloeng . Ebe, sebelisa faele ea hau ea mantlha ea Sass ho kenya mefuta ea hau ea tloaelo, e lateloe ke Bootstrap:
Bakeng sa ho bokella Bootstrap, etsa bonnete ba hore u kenya le ho sebelisa lisebelisoa tse hlokahalang: sass-loader , postcss-loader with Autoprefixer . Ka tlhophiso e fokolang, tlhophiso ea pakete ea hau ea marang-rang e lokela ho kenyelletsa molao ona kapa o tšoanang:
Ntle le moo, o ka sebelisa CSS e ikemiselitseng ho sebelisoa ea Bootstrap ka ho kenyelletsa mohala ona sebakeng sa ho kena sa morero:
Tabeng ena o ka sebelisa molao oa hau o seng o ntse o le teng css
ntle le liphetoho tse khethehileng ho webpack config, ntle le hore ha u hloke sass-loader
feela style-loader le css-loader .