Wɛbpak
Lan aw fɔ put Bootstrap insay yu prɔjek yuz Wɛbpak.
We yu de instɔl di Bootstrap
Instɔl bootstrap as wan Node.js mɔdyul we de yuz npm.
Impɔtant JavaSkript
Impɔt Bootstrap in JavaSkript bay we yu ad dis layn to yu ap in ɛntri pɔynt (bɔku tɛm index.js
ɔ app.js
):
Ɔda we de fɔ du dat, yu kin import plɔgin dɛn wan bay wan as nid de:
Bootstrap de dipen pan jQuery ɛn Popper , dɛn de difayn dɛn wan ya as peerDependencies
, dis min se yu go gɛt fɔ mek shɔ se yu ad dɛn ɔl tu to yu package.json
yuz npm install --save jquery popper.js
.
Impɔt Stayl dɛn
Impɔt Sass we dɛn dɔn kɔmpilayt bifo tɛm
Fɔ ɛnjɔy di ful pɔtnɛshɛl fɔ Bootstrap ɛn kɔstɔmayz am fɔ yu nid, yuz di sɔs fayl dɛn as pat pan yu prɔjek in bɔndling prɔses.
Fɔs, mek yu yon _custom.scss
ɛn yuz am fɔ ɔvalayz di kɔstɔm vɛriɔbul dɛn we dɛn dɔn bil insay . Dɔn, yuz yu men Sass fayl fɔ import yu kɔstɔm vɛriɔbul dɛn, dɔn Bootstrap:
Fɔ mek Bootstrap kɔmpilayt, mek shɔ se yu instɔl ɛn yuz di loda dɛn we yu nid: sass-loader , postcss-loader wit Autoprefixer . Wit minimal setup, yu webpack config shud inklud dis rule or similar:
Impɔt di CSS we dɛn dɔn kɔmpilayt
Ɔda we de fɔ du dat, yu kin yuz Bootstrap in CSS we dɔn rɛdi fɔ yuz bay we yu jɔs ad dis layn to di say we yu de go insay yu prɔjek:
Insay dis kes yu kin yuz yu rul we de naw fɔ css
witout ɛni spɛshal modifyeshɔn to wɛbpak kɔnfig, pas yu nɔ nid sass-loader
jɔs stayl-lɔda ɛn css-lɔda .