Akwatin gidan yanar gizo
Koyi yadda ake haɗa Bootstrap a cikin aikin ku ta amfani da Webpack 3.
Sanya bootstrap azaman ƙirar Node.js ta amfani da npm.
Shigo da Bootstrap's JavaScript ta ƙara wannan layin zuwa wurin shigarwar ka (yawanci index.js
ko app.js
):
A madadin, zaku iya shigo da plugins daban-daban kamar yadda ake buƙata:
Bootstrap ya dogara da jQuery da Popper , waɗannan an ayyana su azaman peerDependencies
, wannan yana nufin cewa dole ne ku tabbatar kun ƙara duka biyun zuwa package.json
amfani da ku npm install --save jquery popper.js
.
Lura cewa idan kun zaɓi shigo da plugins daban-daban , dole ne ku kuma shigar da mai ɗaukar kaya zuwa fitarwa
Don jin daɗin cikakkiyar damar Bootstrap da keɓance shi ga buƙatunku, yi amfani da fayilolin tushen azaman wani ɓangare na tsarin haɗa aikin ku.
Da farko, ƙirƙiri naku _custom.scss
kuma yi amfani da shi don ƙetare ginanniyar masu canji na al'ada . Sannan, yi amfani da babban fayil ɗin sass ɗinku don shigo da masu canjin al'ada, sannan Bootstrap ya biyo baya:
Don Bootstrap don haɗawa, tabbatar da shigar da amfani da masu ɗaukar kaya da ake buƙata: sass-loader , mai ɗaukar hoto tare da Autoprefixer . Tare da ƙaramin saiti, saitin fakitin gidan yanar gizonku yakamata ya haɗa da wannan doka ko makamancin haka:
A madadin, zaku iya amfani da Bootstrap na shirye-shiryen amfani da css ta hanyar ƙara wannan layi kawai zuwa wurin shigarwar aikin ku:
A wannan yanayin zaku iya amfani da ƙa'idar da kuke da ita don css
ba tare da wani gyare-gyare na musamman ba don saita fakitin gidan yanar gizo ba sai dai ba kwa buƙatar sass-loader
kawai mai ɗaukar salo da css-loader .