Source

Mangani zida

Phunzirani momwe mungagwiritsire ntchito zolemba za Bootstrap zomwe zikuphatikizidwa ndi npm kuti mupange zolemba zathu, kuphatikiza ma code source, kuyesa mayeso, ndi zina zambiri.

Kupanga zida

Bootstrap imagwiritsa ntchito zolemba za NPM pamakina ake omanga. Phukusi lathu.json limaphatikizapo njira zosavuta zogwirira ntchito ndi chimango, kuphatikiza kulemba ma code, kuyesa mayeso, ndi zina zambiri.

Kuti mugwiritse ntchito makina athu omanga ndikuyendetsa zolembedwa kwanuko, mufunika kopi ya mafayilo a Bootstrap ndi Node. Tsatirani izi ndipo muyenera kukhala okonzeka kugwedeza:

  1. Tsitsani ndikuyika Node.js , yomwe timagwiritsa ntchito kuyang'anira zomwe timadalira.
  2. Yendetsani ku chikwatu cha mizu /bootstrapndikuthamangira npm installkuti muyike zodalira zathu zomwe zalembedwa pa package.json .
  3. Ikani Ruby , yikani Bundler ndi gem install bundler, ndipo pamapeto pake thamangani bundle install. Izi zidzakhazikitsa kudalira kwa Ruby, monga Jekyll ndi mapulagini.
    • Ogwiritsa ntchito Windows: Werengani bukuli kuti Jekyll ayambe kugwira ntchito popanda mavuto.

Mukamaliza, mudzatha kuyendetsa malamulo osiyanasiyana operekedwa kuchokera pamzere wolamula.

Kugwiritsa ntchito zolemba za NPM

Pack.json yathu ili ndi malamulo ndi ntchito zotsatirazi:

Ntchito Kufotokozera
npm run dist npm run distimapanga /distchikwatu ndi mafayilo ophatikizidwa. Amagwiritsa ntchito Sass , Autoprefixer , ndi UgifyJS .
npm test Mofanana ndi npm run distkuphatikiza imayesa mayeso kwanuko
npm run docs Amamanga ndi kulumikiza CSS ndi JavaScript ya zolemba. Kenako mutha kuyendetsa zolemba kwanuko kudzera pa npm run docs-serve.

Thamangani npm runkuti muwone zolemba zonse za npm.

Autoprefixer

Bootstrap imagwiritsa ntchito Autoprefixer (yophatikizidwa munjira yathu yomanga) kuti ingowonjezera zoyambira zamalonda kuzinthu zina za CSS panthawi yomanga. Kuchita izi kumatipulumutsa nthawi ndi kachidindo potilola kuti tilembe zigawo zazikulu za CSS nthawi imodzi ndikuchotsa kufunikira kwa osakaniza ogulitsa monga omwe amapezeka mu v3.

Timasunga mndandanda wa asakatuli omwe amathandizidwa kudzera mu Autoprefixer mu fayilo ina mkati mwa GitHub yathu. Onani /package.json kuti mumve zambiri.

Zolemba zakomweko

Kuyendetsa zolemba zathu kwanuko kumafuna kugwiritsa ntchito Jekyll, jenereta yosinthika yokhazikika yomwe imatipatsa: zoyambira zimaphatikizapo, mafayilo ozikidwa pa Markdown, ma templates, ndi zina zambiri. Nayi momwe mungayambitsire:

  1. Thamangani pakukhazikitsa zida pamwambapa kuti muyike Jekyll (womanga webusayiti) ndi zodalira zina za Ruby ndi bundle install.
  2. Kuchokera pamndandanda wa mizu /bootstrap, thamangani npm run docs-servemu mzere wolamula.
  3. Tsegulani http://localhost:9001msakatuli wanu, ndipo voilà.

Dziwani zambiri za kugwiritsa ntchito Jekyll powerenga zolemba zake .

Kusaka zolakwika

Mukakumana ndi zovuta pakuyika zodalira, chotsani mitundu yonse yodalira zam'mbuyomu (zapadziko lonse lapansi komanso zam'deralo). Kenako, bwerezaninso npm install.