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
.
Hlokomela hore haeba u khetha ho kenya li-plugins ka bonngoe , u tlameha ho kenya li-exports-loader
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.
Taba ea pele, iketsetse ea hau ' _custom.scss
me u e sebelise ho hlakola litloaelo tse hahelletsoeng . 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 projeke ea hau:
Tabeng ena o ka sebelisa molao oa hau o teng bakeng sa css
ntle le liphetoho tse khethehileng ho webpack config ntle le haeba u sa hloke sass-loader
feela style-loader le css-loader .