Source

Ngawangun parabot

Diajar kumaha ngagunakeun skrip npm kalebet Bootstrap pikeun ngawangun dokuméntasi kami, nyusun kode sumber, ngajalankeun tés, sareng seueur deui.

Setélan pakakas

Bootstrap nganggo skrip NPM pikeun sistem ngawangunna. package.json kami ngawengku métode merenah pikeun gawé bareng kerangka, kaasup kode compiling, ngajalankeun tés, sareng nu sanesna.

Pikeun nganggo sistem ngawangun kami sareng ngajalankeun dokuméntasi kami sacara lokal, anjeun peryogi salinan file sumber Bootstrap sareng Node. Turutan léngkah-léngkah ieu sareng anjeun kedah siap ngagulung:

  1. Ngundeur tur masang Node.js , nu urang pake pikeun ngatur kagumantungan urang.
  2. /bootstrapNapigasi ka diréktori root tur ngajalankeun npm installmasang dependensi lokal urang didaptarkeun di package.json .
  3. Install Ruby , install Bundler kalawan gem install bundler, sarta tungtungna ngajalankeun bundle install. Ieu bakal masang sadaya kagumantungan Ruby, sapertos Jekyll sareng plugins.
    • Pamaké Windows: Baca pituduh ieu pikeun ngajalankeun Jekyll tanpa masalah.

Nalika réngsé, anjeun bakal tiasa ngajalankeun rupa-rupa paréntah anu disayogikeun tina garis paréntah.

Ngagunakeun skrip NPM

Our package.json includes the following commands and tasks:

Task Description
npm run dist npm run dist creates the /dist directory with compiled files. Uses Sass, Autoprefixer, and UglifyJS.
npm test Same as npm run dist plus it runs tests locally
npm run docs Builds and lints CSS and JavaScript for docs. You can then run the documentation locally via npm run docs-serve.

Run npm run to see all the npm scripts.

Autoprefixer

Bootstrap uses Autoprefixer (included in our build process) to automatically add vendor prefixes to some CSS properties at build time. Doing so saves us time and code by allowing us to write key parts of our CSS a single time while eliminating the need for vendor mixins like those found in v3.

We maintain the list of browsers supported through Autoprefixer in a separate file within our GitHub repository. See /package.json for details.

Local documentation

Running our documentation locally requires the use of Jekyll, a decently flexible static site generator that provides us: basic includes, Markdown-based files, templates, and more. Here’s how to get it started:

  1. Run through the tooling setup above to install Jekyll (the site builder) and other Ruby dependencies with bundle install.
  2. From the root /bootstrap directory, run npm run docs-serve in the command line.
  3. Open http://localhost:9001 in your browser, and voilà.

Learn more about using Jekyll by reading its documentation.

Troubleshooting

Upami anjeun ngalaman masalah sareng masang dependensi, cabut sadaya versi kagumantungan saméméhna (global sareng lokal). Lajeng, ngajalankeun deui npm install.