0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-30 12:24:19 +01:00
Bootstrap/docs/templates/pages/less.mustache
2012-01-25 01:45:15 -08:00

694 lines
20 KiB
Plaintext

<div class="alert">
<strong>Heads up!</strong> This page is still under construction and is missing plenty of documentation. Hang tight!
</div>
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>{{_i}}Using LESS with Bootstrap{{/i}}</h1>
<p class="lead">{{_i}}Customize and extend Bootstrap with <a href="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>
<div class="subnav">
<ul class="nav pills">
<li><a href="#builtWith">{{_i}}Built with Less{{/i}}</a></li>
<li><a href="#variables">{{_i}}Variables{{/i}}</a></li>
<li><a href="#mixins">{{_i}}Mixins{{/i}}</a></li>
<li><a href="#compiling">{{_i}}Compiling Bootstrap{{/i}}</a></li>
</ul>
</div>
</header>
<!-- BUILT WITH LESS
================================================== -->
<section id="builtWith">
<div class="page-header">
<h1>{{_i}}Built with LESS{{/i}}</h1>
</div>
<div class="row">
<div class="span4">
<h3>{{_i}}Why LESS?{{/i}}</h3>
<p>{{_i}}Bootstrap is made with LESS at it's core, a dynamic stylesheet language created by our good friend, <a href="http://cloudhead.io">Alexis Sellier</a>. It makes developing systems-based CSS faster, easier, and more fun.{{/i}}</p>
</div>
<div class="span4">
<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>
</div>
<div class="span4">
<h3>{{_i}}Learn more{{/i}}</h3>
<img style="float: right; height: 36px;" src="assets/img/less-logo-large.png" alt="LESS CSS">
<p>{{_i}}Visit the official website at <a href="http://lesscss.org">http://lesscss.org</a> to learn more.{{/i}}</p>
</div>
</div>
<div class="row">
<div class="span4">
<h3><a href="#variables">{{_i}}Variables{{/i}}</a></h3>
<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&mdash;assign colors or pixel values as variables and change them once.{{/i}}</p>
</div>
<div class="span4">
<h3><a href="#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>
</div>
<div class="span4">
<h3>{{_i}}Operations{{/i}}</h3>
<p>{{_i}}Make your grid, leading, and more super flexible by doing the math on the fly with operations. Multiple, divide, add, and subtract your way to CSS sanity.{{/i}}</p>
</div>
</div>
</section>
<!-- VARIABLES
================================================== -->
<section id="variables">
<div class="page-header">
<h1>{{_i}}Bootstrap variables <small></small>{{/i}}</h1>
</div>
<h3>{{_i}}Hyperlinks{{/i}}</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span2">{{_i}}Variable{{/i}}</th>
<th>{{_i}}Value{{/i}}</th>
<th>{{_i}}Usage{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@linkColor</code></td>
<td>#08c</td>
<td>{{_i}}Default link text color{{/i}}</td>
</tr>
<tr>
<td><code>@linkColorHover</code></td>
<td><code>darken(@linkColor, 15%)</code></td>
<td>{{_i}}Default link text hover color{{/i}}</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="span6">
<h3>{{_i}}Grayscale colors{{/i}}</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span2">{{_i}}Variable{{/i}}</th>
<th>{{_i}}Value{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@black</code></td>
<td>#000</td>
</tr>
<tr>
<td><code>@grayDarker</code></td>
<td>#222</td>
</tr>
<tr>
<td><code>@grayDark</code></td>
<td>#333</td>
</tr>
<tr>
<td><code>@gray</code></td>
<td>#555</td>
</tr>
<tr>
<td><code>@grayLight</code></td>
<td>#999</td>
</tr>
<tr>
<td><code>@grayLighter</code></td>
<td>#eee</td>
</tr>
<tr>
<td><code>@white</code></td>
<td>#fff</td>
</tr>
</tbody>
</table>
</div>
<div class="span6">
<h3>{{_i}}Accent colors{{/i}}</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span2">{{_i}}Variable{{/i}}</th>
<th>{{_i}}Value{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@blue</code></td>
<td>#049cdb</td>
</tr>
<tr>
<td><code>@green</code></td>
<td>#46a546</td>
</tr>
<tr>
<td><code>@red</code></td>
<td>#9d261d</td>
</tr>
<tr>
<td><code>@yellow</code></td>
<td>#ffc40d</td>
</tr>
<tr>
<td><code>@orange</code></td>
<td>#f89406</td>
</tr>
<tr>
<td><code>@pink</code></td>
<td>#c3325f</td>
</tr>
<tr>
<td><code>@purple</code></td>
<td>#7a43b6</td>
</tr>
</tbody>
</table>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span6">
<h3>{{_i}}Grid system{{/i}}</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span2">{{_i}}Variable{{/i}}</th>
<th>{{_i}}Value{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@gridColumns</code></td>
<td>12</td>
</tr>
<tr>
<td><code>@gridColumnWidth</code></td>
<td>60px</td>
</tr>
<tr>
<td><code>@gridGutterWidth</code></td>
<td>20px</td>
</tr>
<tr>
<td><code>@siteWidth</code></td>
<td><code>(@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1))</code></td>
</tr>
</tbody>
</table>
</div>
<div class="span6">
<h3>{{_i}}Typography{{/i}}</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span2">{{_i}}Variable{{/i}}</th>
<th>{{_i}}Value{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@baseFontSize</code></td>
<td>13px</td>
</tr>
<tr>
<td><code>@baseFontFamily</code></td>
<td><code>"Helvetica Neue", Helvetica, Arial, sans-serif</code></td>
<td></td>
</tr>
<tr>
<td><code>@baseLineHeight</code></td>
<td>18px</td>
</tr>
</tbody>
</table>
</div>
</div> <!-- /row -->
<h3>{{_i}}Components{{/i}}</h3>
<div class="row">
<div class="span6">
<h4>Buttons</h4>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td class="span3"><code>@primaryButtonColor</code></td>
<td><code>@blue</code></td>
</tr>
</tbody>
</table>
<h4>Forms</h4>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td class="span3"><code>@placeholderText</code></td>
<td><code>@grayLight</code></td>
</tr>
</tbody>
</table>
<h4>Navbar</h4>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td class="span3"><code>@navbarHeight</code></td>
<td>40px</td>
</tr>
<tr>
<td><code>@navbarBackground</code></td>
<td><code>@grayDarker</code></td>
</tr>
<tr>
<td><code>@navbarBackgroundHighlight</code></td>
<td><code>@grayDark</code></td>
</tr>
</tbody>
</table>
</div>
<div class="span6">
<h4>Form states and alerts</h4>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td class="span3"><code>@warningText</code></td>
<td>#f3edd2</td>
</tr>
<tr>
<td><code>@warningBackground</code></td>
<td>#c09853</td>
</tr>
<tr>
<td><code>@warningBorder</code></td>
<td>#f3edd2</td>
</tr>
<tr>
<td><code>@errorText</code></td>
<td>#b94a48</td>
</tr>
<tr>
<td><code>@errorBackground</code></td>
<td>#f2dede</td>
</tr>
<tr>
<td><code>@errorBorder</code></td>
<td>#e9c7c7</td>
</tr>
<tr>
<td><code>@successText</code></td>
<td>#468847</td>
</tr>
<tr>
<td><code>@successBackground</code></td>
<td>#dff0d8</td>
</tr>
<tr>
<td><code>@successBorder</code></td>
<td>#cfe8c4</td>
</tr>
<tr>
<td><code>@infoText</code></td>
<td>#3a87ad</td>
</tr>
<tr>
<td><code>@infoBackground</code></td>
<td>#d9edf7</td>
</tr>
<tr>
<td><code>@infoBorder</code></td>
<td>#bfe1f2</td>
</tr>
</tbody>
</table>
</div>
</div><!-- /row -->
</section>
<!-- MIXINS
================================================== -->
<section id="mixins">
<div class="page-header">
<h1>{{_i}}Bootstrap mixins <small></small>{{/i}}</h1>
</div>
<h2>About mixins</h2>
<div class="row">
<div class="span4">
<h3>Basic mixins</h3>
<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>
<pre class="prettyprint linenums">
Coming soon!
</pre>
</div><!-- /span4 -->
<div class="span4">
<h3>Parametric mixins</h3>
<p>A parametric mixin is just like a basic mixin, but it also accepts optional paramaters (hence the name).</p>
<pre class="prettyprint linenums">
Coming soon!
</pre>
</div><!-- /span4 -->
<div class="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>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span4">Mixin</th>
<th>Paramaters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.clearfix()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.center-block()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.ie7-inline-block()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.size()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.square()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.opacity()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.reset-filter()</code></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h3>Forms</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span4">Mixin</th>
<th>Paramaters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.placeholder()</code></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h3>Typography</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span4">Mixin</th>
<th>Paramaters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#font > #family > .serif()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>#font > #family > .sans-serif()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>#font > #family > .monospace()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>#font > .shorthand()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>#font > .serif()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>#font > .sans-serif()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>#font > .monospace()</code></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h3>Grid system</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span4">Mixin</th>
<th>Paramaters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.fixed-container()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.columns()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.offset()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.gridColumn()</code></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h3>CSS3 properties</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span4">Mixin</th>
<th>Paramaters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.border-radius()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.border-radius-custom()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.box-shadow()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.transition()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.rotate()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.scale()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.translate()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.background-clip()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.background-size()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.box-sizing()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.user-select()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.resizable()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.content-columns()</code></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h3>Backgrounds and gradients</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="span4">Mixin</th>
<th>Paramaters</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.#translucent > .background()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#translucent > .border()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#gradient > .vertical()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#gradient > .horizontal()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#gradient > .directional()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#gradient > .vertical-three-colors()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#gradient > .radial()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#gradient > .striped()</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>.#gradientBar()</code></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</section>
<!-- COMPILING LESS AND BOOTSTRAP
================================================== -->
<section id="compiling">
<div class="page-header">
<h1>{{_i}}Compiling Bootstrap with LESS{{/i}}</h1>
</div>
<div class="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>
<div class="row">
<div class="span4">
<h3>{{_i}}Node with makefile{{/i}}</h3>
<p>{{_i}}Install the LESS command line compiler with npm by running the following command:{{/i}}</p>
<pre>$ npm install less</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 <a href="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>
</div><!-- /span4 -->
<div class="span4">
<h3>{{_i}}Command line{{/i}}</h3>
<p>{{_i}}Install the LESS command line tool via Node and run the following command:{{/i}}</p>
<pre>$ lessc ./lib/bootstrap.less > bootstrap.css</pre>
<p>{{_i}}Be sure to include <code>--compress</code> in that command if you're trying to save some bytes!{{/i}}</p>
</div><!-- /span4 -->
<div class="span4">
<h3>{{_i}}Javascript{{/i}}</h3>
<p>{{_i}}<a href="http://lesscss.org/">Download the latest Less.js</a> and include the path to it (and Bootstrap) in the <code>&lt;head&gt;</code>.{{/i}}</p>
<pre class="prettyprint">
&lt;link rel="stylesheet/less" href="/path/to/bootstrap.less"&gt;
&lt;script src="/path/to/less.js"&gt;&lt;/script&gt;
</pre>
<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>
</div><!-- /span4 -->
</div><!-- /row -->
<div class="row">
<div class="span4">
<h3>{{_i}}Unofficial Mac app{{/i}}</h3>
<p>{{_i}}<a href="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>
</div><!-- /span4 -->
<div class="span4">
<h3>{{_i}}More Mac apps{{/i}}</h3>
<h4><a href="http://crunchapp.net/" target="_blank">Crunch</a></h4>
<p>{{_i}}Crunch is a great looking LESS editor and compiler built on Adobe Air.{{/i}}</p>
<h4><a href="http://incident57.com/codekit/" target="_blank">CodeKit</a></h4>
<p>{{_i}}Created by the same guy as the unofficial Mac app, CodeKit is a Mac app that compiles LESS, SASS, Stylus, and CoffeeScript.{{/i}}</p>
<h4><a href="http://wearekiss.com/simpless" target="_blank">Simpless</a></h4>
<p>{{_i}}Mac, Linux, and PC app for drag and drop compiling of LESS files. Plus, the <a href="https://github.com/Paratron/SimpLESS" target="_blank">source code is on GitHub</a>.{{/i}}</p>
</div><!-- /span4 -->
</div><!-- /row -->
</section>