Merge pull request #13531 from twbs/grunt-html-docs

move Grunt info from README into HTML docs
This commit is contained in:
Mark Otto 2014-05-07 21:30:22 -07:00
commit 00b6f27897
4 changed files with 41 additions and 36 deletions

View File

@ -10,7 +10,6 @@ To get started, check out <http://getbootstrap.com>!
- [Quick start](#quick-start) - [Quick start](#quick-start)
- [Bugs and feature requests](#bugs-and-feature-requests) - [Bugs and feature requests](#bugs-and-feature-requests)
- [Documentation](#documentation) - [Documentation](#documentation)
- [Compiling CSS and JavaScript](#compiling-css-and-javascript)
- [Contributing](#contributing) - [Contributing](#contributing)
- [Community](#community) - [Community](#community)
- [Versioning](#versioning) - [Versioning](#versioning)
@ -78,41 +77,6 @@ Documentation for v2.3.2 has been made available for the time being at <http://g
## Compiling CSS and JavaScript
Bootstrap uses [Grunt](http://gruntjs.com/) with convenient methods for working with the framework. It's how we compile our code, run tests, and more. To use it, install the required dependencies as directed and then run some Grunt commands.
### Install Grunt
From the command line:
1. Install `grunt-cli` globally with `npm install -g grunt-cli`.
2. Navigate to the root `/bootstrap` directory, then run `npm install`. npm will look at [package.json](https://github.com/twbs/bootstrap/blob/master/package.json) and automatically install the necessary local dependencies listed there.
When completed, you'll be able to run the various Grunt commands provided from the command line.
**Unfamiliar with npm? Don't have node installed?** That's a-okay. npm stands for [node packaged modules](http://npmjs.org/) and is a way to manage development dependencies through node.js. [Download and install node.js](http://nodejs.org/download/) before proceeding.
### Available Grunt commands
#### Build - `grunt`
Run `grunt` to run tests locally and compile the CSS and JavaScript into `/dist`. **Uses [Less](http://lesscss.org/) and [UglifyJS](http://lisperator.net/uglifyjs/).**
#### Only compile CSS and JavaScript - `grunt dist`
`grunt dist` creates the `/dist` directory with compiled files. **Uses [Less](http://lesscss.org/) and [UglifyJS](http://lisperator.net/uglifyjs/).**
#### Tests - `grunt test`
Runs [JSHint](http://jshint.com) and [QUnit](http://qunitjs.com/) tests headlessly in [PhantomJS](http://phantomjs.org/) (used for CI).
#### Watch - `grunt watch`
This is a convenience method for watching just Less files and automatically building them whenever you save.
### Troubleshooting dependencies
Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun `npm install`.
## Contributing ## Contributing
Please read through our [contributing guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development. Please read through our [contributing guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.

View File

@ -0,0 +1,32 @@
<div class="bs-docs-section">
<h1 id="grunt" class="page-header">Compiling CSS and JavaScript</h1>
<p class="lead">Bootstrap uses <a href="http://gruntjs.com">Grunt</a> for its build system, with convenient methods for working with the framework. It's how we compile our code, run tests, and more.</p>
<h2 id="grunt-installing">Installing Grunt</h2>
<p>To install Grunt, you must <strong>first <a href="http://nodejs.org/download/">download and install node.js</a></strong> (which includes npm). npm stands for <a href="http://npmjs.org/">node packaged modules</a> and is a way to manage development dependencies through node.js.</p>
Then, from the command line:
<ol>
<li>Install <code>grunt-cli</code> globally with <code>npm install -g grunt-cli</code>.</li>
<li>Navigate to the root <code>/bootstrap/</code> directory, then run <code>npm install</code>. npm will look at the <a href="https://github.com/twbs/bootstrap/blob/master/package.json"><code>package.json</code></a> file and automatically install the necessary local dependencies listed there.</li>
</ol>
<p>When completed, you'll be able to run the various Grunt commands provided from the command line.</p>
<h2 id="grunt-commands">Available Grunt commands</h2>
<h3><code>grunt dist</code> (Just compile CSS and JavaScript)</h3>
<p>Regenerates the <code>/dist/</code> directory with compiled and minified CSS and JavaScript files. As a Bootstrap user, this is normally the command you want.</p>
<h3><code>grunt watch</code> (Watch)</h3>
<p>Watches the Less source files and automatically recompiles them to CSS whenever you save a change.</p>
<h3><code>grunt test</code> (Run tests)</h3>
<p>Runs <a href="http://jshint.com">JSHint</a> and runs the <a href="http://qunitjs.com">QUnit</a> tests headlessly in <a href="http://phantomjs.org">PhantomJS</a>.</p>
<h3><code>grunt</code> (Build absolutely everything and run tests)</h3>
<p>Compiles and minifies CSS and JavaScript, builds the documentation website, runs the HTML5 validator against the docs, regenerates the Customizer assets, and more. Usually only necessary if you're hacking on Bootstrap itself.</p>
<h2 id="grunt-troubleshooting">Troubleshooting</h2>
<p>Should you encounter problems with installing dependencies or running Grunt commands, first delete the <code>/node_modules/</code> directory generated by npm. Then, rerun <code>npm install</code>.</p>
</div>

View File

@ -8,6 +8,14 @@
<li><a href="#whats-included-source">Source code</a></li> <li><a href="#whats-included-source">Source code</a></li>
</ul> </ul>
</li> </li>
<li>
<a href="#grunt">Compiling CSS and JavaScript</a>
<ul class="nav">
<li><a href="#grunt-installing">Installing Grunt</a></li>
<li><a href="#grunt-commands">Available Grunt commands</a></li>
<li><a href="#grunt-troubleshooting">Troubleshooting</a></li>
</ul>
</li>
<li> <li>
<a href="#template">Basic template</a> <a href="#template">Basic template</a>
</li> </li>

View File

@ -7,6 +7,7 @@ lead: "An overview of Bootstrap, how to download and use, basic templates and ex
{% include getting-started/download.html %} {% include getting-started/download.html %}
{% include getting-started/whats-included.html %} {% include getting-started/whats-included.html %}
{% include getting-started/grunt.html %}
{% include getting-started/template.html %} {% include getting-started/template.html %}
{% include getting-started/examples.html %} {% include getting-started/examples.html %}
{% include getting-started/rtl.html %} {% include getting-started/rtl.html %}