in English

Vaka maturusi

Dzidza mashandisiro eBootstrap anosanganisirwa npm zvinyorwa kuvaka zvinyorwa zvedu, kuunganidza sosi kodhi, mhanyisa bvunzo, nezvimwe.

Tooling setup

Bootstrap inoshandisa npm zvinyorwa kune yayo kuvaka system. Yedu package.json inosanganisira nzira dziri nyore dzekushanda nehurongwa, kusanganisira kunyora kodhi, kumhanya bvunzo, nezvimwe.

Kuti ushandise yedu yekuvaka sisitimu uye kumhanyisa zvinyorwa zvedu munharaunda, iwe unozoda kopi yeBootstrap's source mafaera uye Node. Tevera nhanho idzi uye iwe unofanirwa kunge wakagadzirira kuzunungusa:

  1. Dhawunirodha uye isa Node.js , iyo yatinoshandisa kugadzirisa zvatinovimba nazvo.
  2. Pamwe dhawunirodha masosi eBootstrap kana forogo Bootstrap's repository .
  3. Enda kumudzi /bootstrapwedhairekitori uye mhanya npm installkuti uise edu emunharaunda anotsamira akanyorwa mu package.json .

Kana wapedza, unokwanisa kumhanyisa mirairo yakasiyana-siyana yakapihwa kubva kumutsara wekuraira.

Kushandisa npm zvinyorwa

Yedu package.json inosanganisira inotevera mirairo uye mabasa:

Basa Tsanangudzo
npm run dist npm run distinogadzira /dist/dhairekitori nemafaira akaunganidzwa. Inoshandisa Sass , Autoprefixer , uye terser .
npm test Inoita bvunzo munharaunda mushure mekuitanpm run dist
npm run docs-serve Inovaka uye inomhanyisa zvinyorwa munzvimbo.

Mhanya npm runkuti uone zvese zvinyorwa zvenpm.

Tanga neBootstrap kuburikidza nenpm neyekutanga chirongwa chedu! Musoro kune twbs/bootstrap-npm-starter template repository kuti uone maitiro ekuvaka uye kugadzirisa Bootstrap mune yako wega npm purojekiti. Inosanganisira Sass compiler, Autoprefixer, Stylelint, PurgeCSS, uye Bootstrap Icons.

Sass

Bootstrap v4 inoshandisa Node Sass kuunganidza yedu Sass sosi mafaera muCSS mafaera (anosanganisirwa mune yedu kuvaka maitiro). Kuti upedze neiyo yakafanana yakagadzirwa CSS paunenge uchigadzira Sass uchishandisa yako wega pombi, iwe unozofanirwa kushandisa Sass compiler inotsigira angangoita maficha anoita Node Sass. Izvi zvakakosha kuti ticherechedzwe nekuti kubva muna Gumiguru 26, 2020, LibSass nemapakeji akavakirwa pamusoro payo-kusanganisira Node Sass- zvakaregwa .

Kana iwe uchida hutsva hweSass maficha kana kuenderana neazvino CSS zviyero, Dart Sass ikozvino ndiyo yekutanga kusevenzeswa kweSass uye inotsigira JavaScript API inonyatso enderana neNode Sass (nezvimwe zvishoma zvakanyorwa paDart Sass's GitHub peji ).

Isu tinowedzera iyo Sass inotenderedza chaiyo kusvika 6 (nekusarudzika, ndeye 5 muNode Sass) kudzivirira nyaya nebrowser kutenderera. Kana iwe ukashandisa Dart Sass ichi hachizove chinhu chaunoda kugadzirisa, sezvo iyo compiler inoshandisa iyo inotenderedza yegumi uye nekuda kwezvikonzero zvakanaka haitenderi kuti igadziriswe.

Autoprefixer

Bootstrap inoshandisa Autoprefixer (inosanganisirwa mune yedu yekuvaka maitiro) kuti iwedzere otomatiki prefixes kune dzimwe CSS zvivakwa panguva yekuvaka. Kuita izvi kunotichengetera nguva uye kodhi nekutibvumira kunyora zvikamu zvakakosha zveCSS yedu nguva imwe chete tichibvisa kudiwa kwemusanganiswa wevatengesi seanowanikwa muv3.

Isu tinochengetedza runyorwa rwemabhurawuza anotsigirwa kuburikidza neAutoprefixer mune yakaparadzana faira mukati meGitHub yedu repository. Ona .browserslistrc kuti uwane ruzivo.

Zvinyorwa zvemunharaunda

Kumhanyisa zvinyorwa zvedu munharaunda kunoda kushandiswa kweHugo, iyo inoiswa kuburikidza nehugo-bin npm package. Hugo inokurumidza kukurumidza uye yakawedzera static saiti jenareta inotipa: zvakakosha zvinosanganisira, Markdown-based mafaera, matemplate, nezvimwe. Heino maitiro ekutanga:

  1. Mhanya nekuseta kwekushandisa kumusoro kuti uise zvese zvinotsamira.
  2. Kubva pamudzi /bootstrapwedhairekitori, mhanya npm run docs-servemumutsara wekuraira.
  3. Vhura http://localhost:9001/mubrowser yako, uye voilà.

Dzidza zvakawanda nezvekushandisa Hugo nekuverenga zvinyorwa zvayo .

Kugadzirisa matambudziko

Kana iwe ukasangana nezvinetso nekuisa zvinotsamira, bvisa ese ekare anoenderana neshanduro (yepasirese neyemuno). Zvadaro, dzokorora npm install.