<pclass="lead">Extend Bootstrap with <ahref="http://lesscss.org"target="_blank">LESS</a>, a CSS preprocessor, to take advantage of the variables, mixins, and more used to build Bootstrap's CSS.</p>
<p>Bootstrap is made with LESS at its core, a dynamic stylesheet language created by our good friend, <ahref="http://cloudhead.io">Alexis Sellier</a>. It makes developing systems-based CSS faster, easier, and more fun.</p>
<h3>What's included?</h3>
<p>As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.</p>
<p>Visit the official website at <ahref="http://lesscss.org">http://lesscss.org</a> to learn more.</p>
<h3><ahref="#variables">Variables</a></h3>
<p>Managing colors and pixel values in CSS can be a bit of a pain, usually full of copy and paste. Not with LESS though—assign colors or pixel values as variables and change them once.</p>
<h3><ahref="#mixins">Mixins</a></h3>
<p>Those three border-radius declarations you need to make in regular ol' CSS? Now they're down to one line with the help of mixins, snippets of code you can reuse anywhere.</p>
<h3>Operations</h3>
<p>Make your grid, leading, and more super flexible by doing the math on the fly with operations. Multiply, divide, add, and subtract your way to CSS sanity.</p>
<strong>Note:</strong> If you're submitting a pull request to GitHub with modified CSS, you <strong>must</strong> recompile the CSS via any of these methods.
</div>
<h2>Tools for compiling</h2>
<h3>Node with makefile</h3>
<p>Install the LESS command line compiler, JSHint, Recess, and uglify-js globally with npm by running the following command:</p>
<pre>$ npm install -g less jshint recess uglify-js</pre>
<p>Once installed just run <code>make</code> from the root of your bootstrap directory and you're all set.</p>
<p>Additionally, if you have <ahref="https://github.com/mynyml/watchr">watchr</a> installed, you may run <code>make watch</code> to have bootstrap automatically rebuilt every time you edit a file in the bootstrap lib (this isn't required, just a convenience method).</p>
<h3>Command line</h3>
<p>Install the LESS command line tool via Node and run the following command:</p>
<p>To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.</p>
<h3>Unofficial Mac app</h3>
<p><ahref="http://incident57.com/less/">The unofficial Mac app</a> watches directories of .less files and compiles the code to local files after every save of a watched .less file.</p>
<p>If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.</p>
<p>Mac, Linux, and PC app for drag and drop compiling of LESS files. Plus, the <ahref="https://github.com/Paratron/SimpLESS"target="_blank">source code is on GitHub</a>.</p>
<pclass="pull-right"><ahref="#">Back to top</a></p>
<p>Designed and built with all the love in the world <ahref="http://twitter.com/twitter"target="_blank">@twitter</a> by <ahref="http://twitter.com/mdo"target="_blank">@mdo</a> and <ahref="http://twitter.com/fat"target="_blank">@fat</a>.</p>
<p>Code licensed under the <ahref="http://www.apache.org/licenses/LICENSE-2.0"target="_blank">Apache License v2.0</a>. Documentation licensed under <ahref="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <ahref="http://glyphicons.com">Glyphicons Free</a>, licensed under <ahref="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<pclass="lead">Customize and extend Bootstrap with <ahref="http://lesscss.org"target="_blank">LESS</a>, a CSS preprocessor, to take advantage of the variables, mixins, and more used to build Bootstrap's CSS.</p>
<p>Bootstrap is made with LESS at its core, a dynamic stylesheet language created by our good friend, <ahref="http://cloudhead.io">Alexis Sellier</a>. It makes developing systems-based CSS faster, easier, and more fun.</p>
<h3>What's included?</h3>
<p>As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.</p>
<p>Visit the official website at <ahref="http://lesscss.org">http://lesscss.org</a> to learn more.</p>
<h3><ahref="#variables">Variables</a></h3>
<p>Managing colors and pixel values in CSS can be a bit of a pain, usually full of copy and paste. Not with LESS though—assign colors or pixel values as variables and change them once.</p>
<h3><ahref="#mixins">Mixins</a></h3>
<p>Those three border-radius declarations you need to make in regular ol' CSS? Now they're down to one line with the help of mixins, snippets of code you can reuse anywhere.</p>
<h3>Operations</h3>
<p>Make your grid, leading, and more super flexible by doing the math on the fly with operations. Multiply, divide, add, and subtract your way to CSS sanity.</p>
<p>A basic mixin is essentially an include or a partial for a snippet of CSS. They're written just like a CSS class and can be called anywhere.</p>
<preclass="prettyprint linenums">
.element {
.clearfix();
}
</pre>
</div><!-- /span4 -->
<divclass="span4">
<h3>Parametric mixins</h3>
<p>A parametric mixin is just like a basic mixin, but it also accepts parameters (hence the name) with optional default values.</p>
<preclass="prettyprint linenums">
.element {
.border-radius(4px);
}
</pre>
</div><!-- /span4 -->
<divclass="span4">
<h3>Easily add your own</h3>
<p>Nearly all of Bootstrap's mixins are stored in mixins.less, a wonderful utility .less file that enables you to use a mixin in any of the .less files in the toolkit.</p>
<p>So, go ahead and use the existing ones or feel free to add your own as you need.</p>
</div><!-- /span4 -->
</div><!-- /row -->
<h2>Included mixins</h2>
<h3>Utilities</h3>
<tableclass="table table-bordered table-striped">
<thead>
<tr>
<thclass="span4">Mixin</th>
<th>Parameters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.clearfix()</code></td>
<td><emclass="muted">none</em></td>
<td>Add to any parent to clear floats within</td>
</tr>
<tr>
<td><code>.tab-focus()</code></td>
<td><emclass="muted">none</em></td>
<td>Apply the Webkit focus style and round Firefox outline</td>
</tr>
<tr>
<td><code>.center-block()</code></td>
<td><emclass="muted">none</em></td>
<td>Auto center a block-level element using <code>margin: auto</code></td>
</tr>
<tr>
<td><code>.ie7-inline-block()</code></td>
<td><emclass="muted">none</em></td>
<td>Use in addition to regular <code>display: inline-block</code> to get IE7 support</td>
</tr>
<tr>
<td><code>.size()</code></td>
<td><code>@height @width</code></td>
<td>Quickly set the height and width on one line</td>
</tr>
<tr>
<td><code>.square()</code></td>
<td><code>@size</code></td>
<td>Builds on <code>.size()</code> to set the width and height as same value</td>
</tr>
<tr>
<td><code>.opacity()</code></td>
<td><code>@opacity</code></td>
<td>Set, in whole numbers, the opacity percentage (e.g., "50" or "75")</td>
</tr>
</tbody>
</table>
<h3>Forms</h3>
<tableclass="table table-bordered table-striped">
<thead>
<tr>
<thclass="span4">Mixin</th>
<th>Parameters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.placeholder()</code></td>
<td><code>@color: @placeholderText</code></td>
<td>Set the <code>placeholder</code> text color for inputs</td>
<strong>Note:</strong> If you're submitting a pull request to GitHub with modified CSS, you <strong>must</strong> recompile the CSS via any of these methods.
</div>
<h2>Tools for compiling</h2>
<h3>Node with makefile</h3>
<p>Install the LESS command line compiler, JSHint, Recess, and uglify-js globally with npm by running the following command:</p>
<pre>$ npm install -g less jshint recess uglify-js</pre>
<p>Once installed just run <code>make</code> from the root of your bootstrap directory and you're all set.</p>
<p>Additionally, if you have <ahref="https://github.com/mynyml/watchr">watchr</a> installed, you may run <code>make watch</code> to have bootstrap automatically rebuilt every time you edit a file in the bootstrap lib (this isn't required, just a convenience method).</p>
<h3>Command line</h3>
<p>Install the LESS command line tool via Node and run the following command:</p>
<p>To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.</p>
<h3>Unofficial Mac app</h3>
<p><ahref="http://incident57.com/less/">The unofficial Mac app</a> watches directories of .less files and compiles the code to local files after every save of a watched .less file.</p>
<p>If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.</p>
<p>Mac, Linux, and PC app for drag and drop compiling of LESS files. Plus, the <ahref="https://github.com/Paratron/SimpLESS"target="_blank">source code is on GitHub</a>.</p>
<pclass="pull-right"><ahref="#">Back to top</a></p>
<p>Designed and built with all the love in the world <ahref="http://twitter.com/twitter"target="_blank">@twitter</a> by <ahref="http://twitter.com/mdo"target="_blank">@mdo</a> and <ahref="http://twitter.com/fat"target="_blank">@fat</a>.</p>
<p>Code licensed under the <ahref="http://www.apache.org/licenses/LICENSE-2.0"target="_blank">Apache License v2.0</a>. Documentation licensed under <ahref="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <ahref="http://glyphicons.com">Glyphicons Free</a>, licensed under <ahref="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<pclass="lead">{{_i}}Extend Bootstrap with <ahref="http://lesscss.org"target="_blank">LESS</a>, a CSS preprocessor, to take advantage of the variables, mixins, and more used to build Bootstrap's CSS.{{/i}}</p>
<divclass="navbar navbar-subnav">
<divclass="navbar-inner">
<ulclass="nav">
<li><ahref="#builtWith">{{_i}}Built with Less{{/i}}</a></li>
<p>{{_i}}Bootstrap is made with LESS at its core, a dynamic stylesheet language created by our good friend, <ahref="http://cloudhead.io">Alexis Sellier</a>. It makes developing systems-based CSS faster, easier, and more fun.{{/i}}</p>
<h3>{{_i}}What's included?{{/i}}</h3>
<p>{{_i}}As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.{{/i}}</p>
<p>{{_i}}Managing colors and pixel values in CSS can be a bit of a pain, usually full of copy and paste. Not with LESS though—assign colors or pixel values as variables and change them once.{{/i}}</p>
<h3><ahref="#mixins">{{_i}}Mixins{{/i}}</a></h3>
<p>{{_i}}Those three border-radius declarations you need to make in regular ol' CSS? Now they're down to one line with the help of mixins, snippets of code you can reuse anywhere.{{/i}}</p>
<h3>{{_i}}Operations{{/i}}</h3>
<p>{{_i}}Make your grid, leading, and more super flexible by doing the math on the fly with operations. Multiply, divide, add, and subtract your way to CSS sanity.{{/i}}</p>
<h1>{{_i}}Compiling Bootstrap with LESS{{/i}}</h1>
</div>
<divclass="alert alert-info">
{{_i}}<strong>Note:</strong> If you're submitting a pull request to GitHub with modified CSS, you <strong>must</strong> recompile the CSS via any of these methods.{{/i}}
</div>
<h2>{{_i}}Tools for compiling{{/i}}</h2>
<h3>{{_i}}Node with makefile{{/i}}</h3>
<p>{{_i}}Install the LESS command line compiler, JSHint, Recess, and uglify-js globally with npm by running the following command:{{/i}}</p>
<pre>$ npm install -g less jshint recess uglify-js</pre>
<p>{{_i}}Once installed just run <code>make</code> from the root of your bootstrap directory and you're all set.{{/i}}</p>
<p>{{_i}}Additionally, if you have <ahref="https://github.com/mynyml/watchr">watchr</a> installed, you may run <code>make watch</code> to have bootstrap automatically rebuilt every time you edit a file in the bootstrap lib (this isn't required, just a convenience method).{{/i}}</p>
<h3>{{_i}}Command line{{/i}}</h3>
<p>{{_i}}Install the LESS command line tool via Node and run the following command:{{/i}}</p>
<p>{{_i}}Be sure to include <code>--compress</code> in that command if you're trying to save some bytes!{{/i}}</p>
<h3>{{_i}}Javascript{{/i}}</h3>
<p>{{_i}}<ahref="http://lesscss.org/">Download the latest Less.js</a> and include the path to it (and Bootstrap) in the <code><head></code>.{{/i}}</p>
<p>{{_i}}To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.{{/i}}</p>
<h3>{{_i}}Unofficial Mac app{{/i}}</h3>
<p>{{_i}}<ahref="http://incident57.com/less/">The unofficial Mac app</a> watches directories of .less files and compiles the code to local files after every save of a watched .less file.{{/i}}</p>
<p>{{_i}}If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.{{/i}}</p>
<p>{{_i}}Mac, Linux, and PC app for drag and drop compiling of LESS files. Plus, the <ahref="https://github.com/Paratron/SimpLESS"target="_blank">source code is on GitHub</a>.{{/i}}</p>
<pclass="lead">{{_i}}Customize and extend Bootstrap with <ahref="http://lesscss.org"target="_blank">LESS</a>, a CSS preprocessor, to take advantage of the variables, mixins, and more used to build Bootstrap's CSS.{{/i}}</p>
<divclass="navbar navbar-subnav">
<divclass="navbar-inner">
<ulclass="nav">
<li><ahref="#builtWith">{{_i}}Built with Less{{/i}}</a></li>
<p>{{_i}}Bootstrap is made with LESS at its core, a dynamic stylesheet language created by our good friend, <ahref="http://cloudhead.io">Alexis Sellier</a>. It makes developing systems-based CSS faster, easier, and more fun.{{/i}}</p>
<h3>{{_i}}What's included?{{/i}}</h3>
<p>{{_i}}As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.{{/i}}</p>
<p>{{_i}}Managing colors and pixel values in CSS can be a bit of a pain, usually full of copy and paste. Not with LESS though—assign colors or pixel values as variables and change them once.{{/i}}</p>
<h3><ahref="#mixins">{{_i}}Mixins{{/i}}</a></h3>
<p>{{_i}}Those three border-radius declarations you need to make in regular ol' CSS? Now they're down to one line with the help of mixins, snippets of code you can reuse anywhere.{{/i}}</p>
<h3>{{_i}}Operations{{/i}}</h3>
<p>{{_i}}Make your grid, leading, and more super flexible by doing the math on the fly with operations. Multiply, divide, add, and subtract your way to CSS sanity.{{/i}}</p>
<p>{{_i}}A basic mixin is essentially an include or a partial for a snippet of CSS. They're written just like a CSS class and can be called anywhere.{{/i}}</p>
<preclass="prettyprint linenums">
.element {
.clearfix();
}
</pre>
</div><!-- /span4 -->
<divclass="span4">
<h3>{{_i}}Parametric mixins{{/i}}</h3>
<p>{{_i}}A parametric mixin is just like a basic mixin, but it also accepts parameters (hence the name) with optional default values.{{/i}}</p>
<preclass="prettyprint linenums">
.element {
.border-radius(4px);
}
</pre>
</div><!-- /span4 -->
<divclass="span4">
<h3>{{_i}}Easily add your own{{/i}}</h3>
<p>{{_i}}Nearly all of Bootstrap's mixins are stored in mixins.less, a wonderful utility .less file that enables you to use a mixin in any of the .less files in the toolkit.{{/i}}</p>
<p>{{_i}}So, go ahead and use the existing ones or feel free to add your own as you need.{{/i}}</p>
</div><!-- /span4 -->
</div><!-- /row -->
<h2>{{_i}}Included mixins{{/i}}</h2>
<h3>{{_i}}Utilities{{/i}}</h3>
<tableclass="table table-bordered table-striped">
<thead>
<tr>
<thclass="span4">{{_i}}Mixin{{/i}}</th>
<th>{{_i}}Parameters{{/i}}</th>
<th>{{_i}}Usage{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.clearfix()</code></td>
<td><emclass="muted">none</em></td>
<td>{{_i}}Add to any parent to clear floats within{{/i}}</td>
</tr>
<tr>
<td><code>.tab-focus()</code></td>
<td><emclass="muted">none</em></td>
<td>{{_i}}Apply the Webkit focus style and round Firefox outline{{/i}}</td>
</tr>
<tr>
<td><code>.center-block()</code></td>
<td><emclass="muted">none</em></td>
<td>{{_i}}Auto center a block-level element using <code>margin: auto</code>{{/i}}</td>
</tr>
<tr>
<td><code>.ie7-inline-block()</code></td>
<td><emclass="muted">none</em></td>
<td>{{_i}}Use in addition to regular <code>display: inline-block</code> to get IE7 support{{/i}}</td>
</tr>
<tr>
<td><code>.size()</code></td>
<td><code>@height @width</code></td>
<td>{{_i}}Quickly set the height and width on one line{{/i}}</td>
</tr>
<tr>
<td><code>.square()</code></td>
<td><code>@size</code></td>
<td>{{_i}}Builds on <code>.size()</code> to set the width and height as same value{{/i}}</td>
</tr>
<tr>
<td><code>.opacity()</code></td>
<td><code>@opacity</code></td>
<td>{{_i}}Set, in whole numbers, the opacity percentage (e.g., "50" or "75"){{/i}}</td>
</tr>
</tbody>
</table>
<h3>Forms</h3>
<tableclass="table table-bordered table-striped">
<thead>
<tr>
<thclass="span4">{{_i}}Mixin{{/i}}</th>
<th>{{_i}}Parameters{{/i}}</th>
<th>{{_i}}Usage{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.placeholder()</code></td>
<td><code>@color: @placeholderText</code></td>
<td>{{_i}}Set the <code>placeholder</code> text color for inputs{{/i}}</td>
</tr>
</tbody>
</table>
<h3>Typography</h3>
<tableclass="table table-bordered table-striped">
<thead>
<tr>
<thclass="span4">{{_i}}Mixin{{/i}}</th>
<th>{{_i}}Parameters{{/i}}</th>
<th>{{_i}}Usage{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#font > #family > .serif()</code></td>
<td><emclass="muted">none</em></td>
<td>{{_i}}Make an element use a serif font stack{{/i}}</td>
<h1>{{_i}}Compiling Bootstrap with LESS{{/i}}</h1>
</div>
<divclass="alert alert-info">
{{_i}}<strong>Note:</strong> If you're submitting a pull request to GitHub with modified CSS, you <strong>must</strong> recompile the CSS via any of these methods.{{/i}}
</div>
<h2>{{_i}}Tools for compiling{{/i}}</h2>
<h3>{{_i}}Node with makefile{{/i}}</h3>
<p>{{_i}}Install the LESS command line compiler, JSHint, Recess, and uglify-js globally with npm by running the following command:{{/i}}</p>
<pre>$ npm install -g less jshint recess uglify-js</pre>
<p>{{_i}}Once installed just run <code>make</code> from the root of your bootstrap directory and you're all set.{{/i}}</p>
<p>{{_i}}Additionally, if you have <ahref="https://github.com/mynyml/watchr">watchr</a> installed, you may run <code>make watch</code> to have bootstrap automatically rebuilt every time you edit a file in the bootstrap lib (this isn't required, just a convenience method).{{/i}}</p>
<h3>{{_i}}Command line{{/i}}</h3>
<p>{{_i}}Install the LESS command line tool via Node and run the following command:{{/i}}</p>
<p>{{_i}}Be sure to include <code>--compress</code> in that command if you're trying to save some bytes!{{/i}}</p>
<h3>{{_i}}Javascript{{/i}}</h3>
<p>{{_i}}<ahref="http://lesscss.org/">Download the latest Less.js</a> and include the path to it (and Bootstrap) in the <code><head></code>.{{/i}}</p>
<p>{{_i}}To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.{{/i}}</p>
<h3>{{_i}}Unofficial Mac app{{/i}}</h3>
<p>{{_i}}<ahref="http://incident57.com/less/">The unofficial Mac app</a> watches directories of .less files and compiles the code to local files after every save of a watched .less file.{{/i}}</p>
<p>{{_i}}If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.{{/i}}</p>
<p>{{_i}}Mac, Linux, and PC app for drag and drop compiling of LESS files. Plus, the <ahref="https://github.com/Paratron/SimpLESS"target="_blank">source code is on GitHub</a>.{{/i}}</p>