Paetukutuku
Akohia me pehea te whakauru i a Bootstrap ki to kaupapa ma te whakamahi i te Tukutuku 3.
Tāutahia te bootstrap hei kōwae Node.js mā te npm.
Kawemai i te JavaScript a Bootstrap ma te taapiri i tenei raina ki te waahi urunga o to taupānga (te tikanga index.js
ko app.js
):
Hei tauira, ka taea e koe te kawemai i nga taputapu takitahi ina hiahiatia:
Kei te whakawhirinaki a Bootstrap ki te jQuery me te Popper , kua tautuhia enei, ko te peerDependencies
tikanga me mohio koe ki te taapiri i enei mea e rua ki to package.json
whakamahi npm install --save jquery popper.js
.
Kia mohio koe ki te whiriwhiri koe ki te kawemai i nga monomai takitahi , me whakauru ano koe ki te kawe kawe-uta
Ki te pai ki te katoa o Bootstrap me te whakarite kia rite ki o hiahia, whakamahia nga konae puna hei waahanga o te mahi paihere o to kaupapa.
Tuatahi, hanga i a koe ake _custom.scss
ka whakamahi ki te whakakore i nga taurangi ritenga kua hangaia . Na, whakamahia to kōnae sass matua ki te kawemai i o taurangi ritenga, ka whai mai ko Bootstrap:
Mo te whakahiato a Bootstrap, me whakauru koe me te whakamahi i nga kaieke e hiahiatia ana: sass-loader , postcss-loader with Autoprefixer . Ma te iti o te tatūnga, me whakauru atu ki to whirihora kete tukutuku tenei ture, he rite ranei:
Hei tauira, ka taea e koe te whakamahi css reri-ki-te whakamahi a Bootstrap ma te taapiri noa i tenei raina ki te waahi urunga o to kaupapa:
I tenei keehi ka taea e koe te whakamahi i to ture o naianei mo te css
kore he whakarereketanga motuhake ki te whirihoranga webpack engari karekau koe e hiahia sass-loader
ki te kai-ahua me te css-loader anake .