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:
- Tsitsani ndikuyika Node.js , yomwe timagwiritsa ntchito kuyang'anira zomwe timadalira.
- Mutha tsitsani magwero a Bootstrap kapena foloko ya Bootstrap .
- Yendetsani ku chikwatu cha mizu
/bootstrap
ndikuthamangiranpm install
kuti muyike zodalira zathu zomwe zalembedwa pa package.json .
Mukamaliza, mudzatha kuyendetsa malamulo osiyanasiyana operekedwa kuchokera pamzere wolamula.
Kugwiritsa ntchito npm scripts
Phukusi lathu.json lili ndi ntchito zambiri zopangira polojekitiyi. Thamangani npm run
kuti muwone zolemba zonse za npm mu terminal yanu. Ntchito zoyamba zikuphatikizapo:
Ntchito | Kufotokozera |
---|---|
npm start |
Amapanga CSS ndi JavaScript, amapanga zolemba, ndikuyambitsa seva yakomweko. |
npm run dist |
Amapanga dist/ chikwatu chokhala ndi mafayilo ophatikizidwa. Imafunika Sass , Autoprefixer , ndi terser . |
npm test |
Imayesa zoyesa kwanuko ikathanpm run dist |
npm run docs-serve |
Amamanga ndikuyendetsa zolembedwa kwanuko. |
Sass
Bootstrap imagwiritsa ntchito Dart Sass popanga mafayilo athu a Sass kukhala mafayilo a CSS (ophatikizidwa munjira yathu yomanga), ndipo tikukulimbikitsani kuti muchite zomwezo ngati mukulemba Sass pogwiritsa ntchito payipi yanuyanu. Tidagwiritsa ntchito Node Sass ya Bootstrap v4, koma LibSass ndi mapaketi omangidwa pamwamba pake, kuphatikiza Node Sass, tsopano achotsedwa .
Dart Sass imagwiritsa ntchito kulondola kozungulira kwa 10 ndipo pazifukwa zogwira mtima sikulola kusintha kwa mtengowu. Sititsitsa kulondola uku pokonza CSS yathu yopangidwa, monga nthawi yochepetsera, koma ngati mwasankha kutero tikukulimbikitsani kuti musachedwe kutsata njira zosachepera 6 kuti mupewe zovuta zakusakatula.
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 .browserslistrc kuti mumve zambiri.
Mtengo wa RTLCSS
Bootstrap imagwiritsa ntchito RTLCSS kukonza CSS yophatikizidwa ndikusintha kukhala RTL - makamaka m'malo mwa zinthu zomwe zimadziwika bwino (mwachitsanzo. padding-left
) ndi zotsutsana nazo. Zimatithandiza kulemba CSS yathu kamodzi kokha ndikupanga zosintha zazing'ono pogwiritsa ntchito RTLCSS kuwongolera ndi malangizo amtengo wapatali .
Zolemba zakomweko
Kuyendetsa zolemba zathu kwanuko kumafuna kugwiritsa ntchito Hugo, yomwe imayikidwa kudzera pa hugo-bin npm phukusi. Hugo ndi jenereta yothamanga kwambiri komanso yowonjezera yomwe imatipatsa ife: zoyambira zimaphatikizapo, mafayilo ozikidwa pa Markdown, ma templates, ndi zina zambiri. Nayi momwe mungayambitsire:
- Yambitsani kukhazikitsidwa kwa zida pamwambapa kuti muyike zodalira zonse.
- Kuchokera pamndandanda wa mizu
/bootstrap
, thamanganinpm run docs-serve
mu mzere wolamula. - Tsegulani
http://localhost:9001/
msakatuli wanu, ndipo voilà.
Dziwani zambiri za kugwiritsa ntchito Hugo 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
.