ابزار بسازید
بیاموزید که چگونه از اسکریپت های npm موجود در Bootstrap برای ساخت اسناد، کامپایل کد منبع، اجرای تست ها و موارد دیگر استفاده کنید.
بوت استرپ از اسکریپت های NPM برای سیستم ساخت خود استفاده می کند. package.json ما شامل روشهای مناسب برای کار با چارچوب است، از جمله کامپایل کد، اجرای آزمایشها و موارد دیگر.
برای استفاده از سیستم ساخت ما و اجرای مستندات ما به صورت محلی، به یک کپی از فایل های منبع بوت استرپ و Node نیاز دارید. این مراحل را دنبال کنید و باید آماده باشید:
- Node.js را دانلود و نصب کنید که از آن برای مدیریت وابستگی های خود استفاده می کنیم.
/bootstrapبه دایرکتوری ریشه بروید وnpm installبرای نصب وابستگیهای محلی فهرست شده در package.json اجرا کنید .- Ruby را نصب کنید، باندلر را با نصب کنید
gem install bundlerو در نهایت اجراbundle installکنید. با این کار تمام وابستگیهای Ruby مانند Jekyll و افزونهها نصب میشود.- کاربران ویندوز: این راهنما را بخوانید تا جکیل بدون مشکل راه اندازی شود.
پس از تکمیل، می توانید دستورات مختلف ارائه شده از خط فرمان را اجرا کنید.
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
/bootstrapdirectory, runnpm run docs-servein the command line. - Open
http://localhost:9001in your browser, and voilà.
Learn more about using Jekyll by reading its documentation.
اگر در نصب وابستگی ها با مشکل مواجه شدید، تمام نسخه های وابستگی قبلی (جهانی و محلی) را حذف نصب کنید. سپس، دوباره npm installاجرا کنید.