in English

Wulite ngwaọrụ

Mụta ka esi eji Bootstrap's gụnyere npm scripts iji wuo akwụkwọ anyị, chịkọta koodu isi mmalite, mee nnwale na ndị ọzọ.

Ntọlite ​​ngwa ọrụ

Bootstrap na-eji npm scripts maka usoro nrụpụta ya. Package anyị.json gụnyere ụzọ dabara adaba maka ịrụ ọrụ n'usoro, gụnyere koodu nchịkọta, ule ịgba ọsọ, na ndị ọzọ.

Iji jiri sistemụ nrụpụta anyị wee mee akwụkwọ anyị na mpaghara, ị ga-achọ otu faịlụ isi mmalite Bootstrap na Node. Soro usoro ndị a ma ị ga-adị njikere ịme mkpọtụ:

  1. Budata ma wụnye Node.js , nke anyị na-eji jikwaa ndabere anyị.
  2. Budata isi mmalite Bootstrap ma ọ bụ ebe nchekwa Bootstrap ndụdụ .
  3. Gaa na ndekọ mgbọrọgwụ /bootstrapwee gbaa ọsọ npm installiji wụnye ndabere mpaghara anyị edepụtara na ngwugwu.json .

Mgbe emechara, ị ga-enwe ike ịme iwu dị iche iche enyere site na ahịrị iwu.

Iji npm script

Package anyị.json gụnyere iwu na ọrụ ndị a:

Ọrụ Nkọwa
npm run dist npm run distna-emepụta /dist/ndekọ na faịlụ chịkọtara. Na- eji Sass , Autoprefixer , na terser .
npm test Na-agba ule na mpaghara ka ọ gbachara ọsọnpm run dist
npm run docs-serve Na-ewu ma na-agba akwụkwọ na mpaghara.

Gbaa ọsọ npm runka ịhụ npm script niile.

Bido na Bootstrap site na npm site na iji ọrụ mmalite anyị! Gaba na twbs/bootstrap-npm-starter template repository ịhụ ka esi ewu na hazie Bootstrap n'ime ọrụ npm nke gị. Gụnyere Sass compiler, Autoprefixer, Stylelint, PurgeCSS, na Bootstrap Icons.

Sass

Bootstrap v4 na-eji Node Sass maka ịchịkọta faịlụ isi iyi Sass n'ime faịlụ CSS (gụnyere na usoro nrụpụta anyị). Iji nweta otu CSS emepụtara mgbe ị na-agbakọ Sass site na iji pipeline akụrụngwa nke gị, ị ga-achọ iji mkpokọta Sass na-akwado opekata mpe atụmatụ nke Node Sass na-eme. Nke a dị mkpa iburu n'obi n'ihi na dịka Ọktoba 26, 2020, LibSass na ngwungwu ewuru n'elu ya—gụnyere Node Sass— kwụsịla .

Ọ bụrụ na ịchọrọ njirimara Sass ọhụrụ ma ọ bụ ndakọrịta na ụkpụrụ CSS ọhụrụ, Dart Sass bụ ugbu a bụ isi mmejuputa iwu nke Sass ma na-akwado API Javascript nke dabara na Node Sass (na mwepu ole na ole edepụtara na ibe Dart Sass GitHub ).

Anyị na-abawanye nkenke Sass okirikiri ka ọ bụrụ 6 (site na ndabara, ọ bụ 5 na Node Sass) iji gbochie nsogbu na mkpokọta ihe nchọgharị. Ọ bụrụ na ị na-eji Dart Sass nke a agaghị abụ ihe ịchọrọ ịgbanwe, ebe onye nchịkọta ahụ na-eji nhazi nkenke 10 na maka ịrụ ọrụ nke ọma anaghị ekwe ka ọ gbanwee ya.

Akpa prefixer

Bootstrap na-eji Autoprefixer (gụnyere na usoro nrụpụta anyị) iji tinye prefixes ndị na-ere ahịa na ụfọdụ akụrụngwa CSS n'oge nrụpụta. Ime nke a na-azọpụta anyị oge na koodu site n'ikwe ka anyị dee akụkụ ndị bụ isi nke CSS anyị otu oge ka anyị na-ewepụ mkpa mixins ndị na-ere ahịa dị ka ndị ahụ na v3.

Anyị na-edobe ndepụta ihe nchọgharị akwadoro site na Autoprefixer na faịlụ dị iche n'ime ebe nchekwa GitHub anyị. Hụ .browserslistrc maka nkọwa.

Akwụkwọ mpaghara

Ịme akwụkwọ anyị na mpaghara chọrọ iji Hugo, nke etinyere site na ngwugwu hugo-bin npm. Hugo bụ onye na-emepụta saịtị kwụ ọtọ nke ukwuu nke na-enye anyị: nke bụ isi gụnyere, faịlụ dabere na Markdown, ndebiri na ndị ọzọ. Nke a bụ otu esi amalite ya:

  1. Gaa na ntọala ngwaọrụ dị n'elu ka ịwụnye ndabere niile.
  2. Site na ndekọ mgbọrọgwụ /bootstrap, na-agba ọsọ npm run docs-servena ahịrị iwu.
  3. Mepee http://localhost:9001/na ihe nchọgharị gị, wee voilà.

Mụtakwuo maka iji Hugo site n'ịgụ akwụkwọ ya .

Nchọpụta nsogbu

Ọ bụrụ na ị ga-enwe nsogbu na ịwụnye ndabere, wepụ ụdị ndabere niile gara aga (ụwa na mpaghara). Mgbe ahụ, megharịa npm install.