Ngawangun parabot
Diajar kumaha ngagunakeun skrip npm kalebet Bootstrap pikeun ngawangun dokuméntasi kami, nyusun kode sumber, ngajalankeun tés, sareng seueur deui.
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:
- Ngundeur tur masang Node.js , nu urang pake pikeun ngatur kagumantungan urang.
/bootstrap
Napigasi ka diréktori root tur ngajalankeunnpm install
masang dependensi lokal urang didaptarkeun di package.json .- Install Ruby , install Bundler kalawan
gem install bundler
, sarta tungtungna ngajalankeunbundle 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.
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.
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.
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:
- Run through the tooling setup above to install Jekyll (the site builder) and other Ruby dependencies with
bundle install
. - From the root
/bootstrap
directory, runnpm run docs-serve
in the command line. - Open
http://localhost:9001
in your browser, and voilà.
Learn more about using Jekyll by reading its documentation.
Upami anjeun ngalaman masalah sareng masang dependensi, cabut sadaya versi kagumantungan saméméhna (global sareng lokal). Lajeng, ngajalankeun deui npm install
.