Source

Gina kayan aikin

Koyi yadda ake amfani da rubutun npm na Bootstrap da aka haɗa don gina takaddun mu, tattara lambar tushe, gudanar da gwaje-gwaje, da ƙari.

Saitin kayan aiki

Bootstrap yana amfani da rubutun NPM don tsarin ginin sa. Kunshin mu.json ya haɗa da hanyoyin dacewa don aiki tare da tsarin, gami da haɗa lamba, gwaje-gwaje masu gudana, da ƙari.

Don amfani da tsarin ginin mu da gudanar da takaddunmu a gida, kuna buƙatar kwafin fayilolin tushen Bootstrap da Node. Bi waɗannan matakan kuma yakamata ku kasance cikin shiri don girgiza:

  1. Zazzage kuma shigar Node.js , wanda muke amfani da shi don sarrafa abubuwan dogaronmu.
  2. Kewaya zuwa tushen /bootstrapdirectory kuma gudu npm installdon shigar da abubuwan dogaronmu na gida da aka jera a cikin kunshin.json .
  3. Shigar Ruby , shigar da Bundler tare da gem install bundler, kuma a ƙarshe gudu bundle install. Wannan zai shigar da duk abin dogara Ruby, kamar Jekyll da plugins.
    • Masu amfani da Windows: Karanta wannan jagorar don haɓaka Jekyll da aiki ba tare da matsala ba.

Lokacin da aka gama, zaku iya aiwatar da umarni daban-daban da aka bayar daga layin umarni.

Yin amfani da rubutun NPM

Kunshin mu.json ya ƙunshi umarni da ayyuka masu zuwa:

Aiki Bayani
npm run dist npm run distyana ƙirƙirar kundin /distadireshi tare da haɗa fayilolin. Yana amfani da Sass , Autoprefixer , da UglifyJS .
npm test Daidai da npm run distƙari yana gudanar da gwaje-gwaje a cikin gida
npm run docs Gina da lints CSS da JavaScript don takardu. Sannan zaku iya gudanar da takaddun cikin gida ta hanyar npm run docs-serve.

Gudu npm rundon ganin duk rubutun npm.

Autoprefixer

Bootstrap yana amfani da Autoprefixer (wanda aka haɗa a cikin tsarin ginin mu) don ƙara prefixes na tallace-tallace ta atomatik zuwa wasu kaddarorin CSS a lokacin ginawa. Yin haka yana ceton mu lokaci da lamba ta hanyar ba mu damar rubuta mahimman sassan CSS ɗin mu lokaci guda yayin kawar da buƙatar haɗaɗɗun masu siyarwa kamar waɗanda aka samu a v3.

Muna kula da jerin masu binciken da aka tallafa ta hanyar Autoprefixer a cikin wani fayil daban a cikin ma'ajin GitHub. Duba /.browslistrc don cikakkun bayanai.

Takardun gida

Gudanar da takaddun mu a cikin gida yana buƙatar amfani da Jekyll, ingantacciyar hanyar samar da rukunin yanar gizon da ke ba mu: asali ya haɗa da, fayilolin Markdown, samfuri, da ƙari. Ga yadda za a fara shi:

  1. Gudu ta hanyar saitin kayan aikin da ke sama don shigar da Jekyll (Maginin rukunin yanar gizon) da sauran abubuwan dogaro da Ruby tare da bundle install.
  2. Daga tushen /bootstrapdirectory, gudu npm run docs-servea cikin layin umarni.
  3. Bude http://localhost:9001a cikin burauzar ku, kuma voilà.

Ƙara koyo game da amfani da Jekyll ta karanta takaddun sa .

Shirya matsala

Idan kun haɗu da matsaloli tare da shigar da abubuwan dogaro, cire duk nau'ikan dogaro da suka gabata (na duniya da na gida). Sa'an nan, sake yi npm install.