Nyatakakadzraɖoƒe ƒe agbalẽvi
Srɔ̃ alesi nàde Bootstrap wò dɔa me to Webpack 3 zazã me.
De bootstrap abe Node.js module ene to npm zazã me.
Tsɔ Bootstrap ƒe JavaScript la va to fli sia tsɔtsɔ kpe ɖe wò dɔwɔnua ƒe teƒe si nàge ɖo ŋu (zi geɖe la, index.js
alo app.js
):
Alo àte ŋu atsɔ plugins ɖekaɖeka ne ehiã:
Bootstrap nɔ te ɖe jQuery kple Popper dzi , woɖe esiawo gɔme be peerDependencies
, esia fia be ele be nàkpɔ egbɔ be yetsɔ wo ame evea siaa kpe ɖe wò package.json
zazã npm install --save jquery popper.js
ŋu .
Be nàse vivi na Bootstrap ƒe ŋutete bliboa eye nàtrɔ asi le eŋu wòasɔ ɖe wò hiahiãwo nu la, zã dzɔtsoƒe faɛlwo abe wò dɔa ƒe ƒuƒoƒo ƒe ɖoɖoa ƒe akpa aɖe ene.
Gbã la, wɔ tɔwò _custom.scss
eye nàzãe atsɔ axe mɔ ɖe custom variables siwo wotu ɖe eme la nu . Emegbe, zã wò Sass faɛl vevitɔ nàtsɔ axɔ wò tɔtrɔ siwo nèwɔ ɖe ɖoɖo nu, eye nàtsɔ Bootstrap akplɔe ɖo:
Be Bootstrap naƒo ƒu la, kpɔ egbɔ be yede agbatsɔnu siwo hiã la eye yezã wo: sass-loader , postcss-loader kple Autoprefixer . Ne èwɔ ɖoɖo sue aɖe ko la, ele be wò webpack ƒe ɖoɖowɔɖi nade se sia alo esi sɔ kplii me:
Alo, àteŋu azã Bootstrap ƒe CSS si sɔ na zazã to fli sia tsɔtsɔ kpe ɖe wò dɔa ƒe gegeɖeƒe ŋu ko me:
Le nɔnɔme sia me la, àteŋu azã wò se si li fifia na tɔtrɔ tɔxɛ aɖeke manɔmee le webpack config ŋu, negbe ɖeko css
mèhiã style-loader kple css-loader ko o.sass-loader