Tanga umusanzu
Fasha guteza imbere Bootstrap hamwe ninyandiko zacu zubaka inyandiko n'ibizamini.
Igikoresho
Bootstrap ikoresha inyandiko ya npm kugirango yubake inyandiko kandi ikusanya amadosiye yinkomoko. Package yacu.json ibika iyi nyandiko yo gukusanya code, gukora ibizamini, nibindi byinshi. Ibi ntabwo bigenewe gukoreshwa hanze yububiko bwacu hamwe ninyandiko.
Kugirango ukoreshe sisitemu yo kubaka no gukoresha inyandiko zacu mugace, uzakenera kopi ya dosiye ya Bootstrap yinkomoko na Node. Kurikiza izi ntambwe kandi ugomba kuba witeguye kunyeganyega:
- Kuramo hanyuma ushyire Node.js , dukoresha mugucunga ibyo twishingikirije.
- Hitamo gukuramo inkomoko ya Bootstrap cyangwa fork ububiko bwa Bootstrap .
- Kujya mumuzi
/bootstrap
yububiko hanyuma wirukenpm install
kugirango ushyireho ibyo twishingikirije kurutonde rwa pack.json .
Numara kuzuza, uzashobora gukoresha amategeko atandukanye yatanzwe kuva kumurongo.
Gukoresha inyandiko za npm
Package yacu.json ikubiyemo imirimo myinshi yo guteza imbere umushinga. Iruka npm run
kugirango urebe inyandiko zose za npm muri terminal yawe. Inshingano z'ibanze zirimo:
Inshingano | Ibisobanuro |
---|---|
npm start |
Gukusanya CSS na JavaScript, yubaka inyandiko, kandi itangira seriveri yaho. |
npm run dist |
Kurema dist/ ububiko hamwe namadosiye yakozwe. Irasaba Sass , Autoprefixer , na terser . |
npm test |
Gukora ibizamini byaho nyuma yo kwirukanpm run dist |
npm run docs-serve |
Yubaka kandi ikoresha ibyangombwa byaho. |
Sass
Bootstrap ikoresha Dart Sass mugukusanya amadosiye yacu ya Sass muri dosiye ya CSS (yashyizwe mubikorwa byacu byo kubaka), kandi turagusaba ko wabikora niba urimo ukora Sass ukoresheje umuyoboro wawe bwite. Twabanje gukoresha Node Sass kuri Bootstrap v4, ariko LibSass hamwe nububiko bwubatswe hejuru yacyo, harimo na Node Sass, ubu birataye agaciro .
Dart Sass ikoresha uruziga rusobanutse rwa 10 kandi kubwimpamvu zikora neza ntabwo zemerera guhindura agaciro. Ntabwo dushyira ahagaragara ubu busobanuro mugihe cyo kurushaho gutunganya CSS twabyaye, nko mugihe cyo kugabanya, ariko niba wahisemo kubikora turasaba kugumana byibuze byibuze 6 kugirango twirinde ibibazo hamwe no kuzenguruka mushakisha.
Autoprefixer
Bootstrap ikoresha Autoprefixer (ikubiye mubikorwa byacu byo kubaka) kugirango ihite yongeramo ibicuruzwa byabacuruzi kubintu bimwe na bimwe bya CSS mugihe cyo kubaka. Kubikora bidutwara umwanya na code mukwemerera kwandika ibice byingenzi bya CSS yacu icyarimwe mugihe cyo gukuraho ibikenerwa bivangwa nabacuruzi nkibiboneka muri v3.
Turakomeza urutonde rwa mushakisha ushyigikiwe na Autoprefixer muri dosiye itandukanye mububiko bwacu bwa GitHub. Reba .browserslistrc kubisobanuro birambuye.
RTLCSS
Bootstrap ikoresha RTLCSS mugutunganya CSS yakozwe no kuyihindura kuri RTL - mubyukuri gusimbuza icyerekezo gitambitse kimenya imitungo (urugero. padding-left
) Nibinyuranye. Iratwemerera kwandika CSS yacu inshuro imwe gusa no gukora udukoryo duto dukoresheje igenzura rya RTLCSS hamwe nubuyobozi bwagaciro .
Inyandiko zaho
Gukoresha inyandiko zacu bisaba gukoresha Hugo, igashyirwaho binyuze muri pake ya hugo-bin npm. Hugo nihuta cyane kandi yagutse cyane ya generator yurubuga iduha: ibyibanze birimo, Markdown ishingiye kuri dosiye, inyandikorugero, nibindi byinshi. Dore uko wabitangira:
- Koresha ukoresheje ibikoresho byashizweho hejuru kugirango ushyireho ibintu byose.
- Kuva kumuzi
/bootstrap
yububiko, koreshanpm run docs-serve
mumurongo wumurongo. - Fungura
http://localhost:9001/
muri mushakisha yawe, na voilà.
Wige byinshi kubyerekeye gukoresha Hugo usoma inyandiko zayo .
Gukemura ibibazo
Ugomba guhura nibibazo byo kwishyiriraho, kuramo verisiyo zose zabanjirije kwishingikiriza (kwisi yose hamwe n’ibanze). Noneho, ongera usubire npm install
.