2012-06-28 08:56:00 +02:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
2012-10-08 06:38:28 +02:00
< title > Extend · Bootstrap< / title >
2012-06-28 08:56:00 +02:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< meta name = "description" content = "" >
< meta name = "author" content = "" >
<!-- Le styles -->
< link href = "assets/css/bootstrap.css" rel = "stylesheet" >
< link href = "assets/css/docs.css" rel = "stylesheet" >
< link href = "assets/js/google-code-prettify/prettify.css" rel = "stylesheet" >
<!-- Le HTML5 shim, for IE6 - 8 support of HTML5 elements -->
<!-- [if lt IE 9]>
< script src = "http://html5shim.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
<!-- Le fav and touch icons -->
2012-10-31 18:41:41 +01:00
< link rel = "shortcut icon" href = "assets/ico/favicon.png" >
2012-06-28 08:56:00 +02:00
< link rel = "apple-touch-icon-precomposed" sizes = "144x144" href = "assets/ico/apple-touch-icon-144-precomposed.png" >
< link rel = "apple-touch-icon-precomposed" sizes = "114x114" href = "assets/ico/apple-touch-icon-114-precomposed.png" >
< link rel = "apple-touch-icon-precomposed" sizes = "72x72" href = "assets/ico/apple-touch-icon-72-precomposed.png" >
< link rel = "apple-touch-icon-precomposed" href = "assets/ico/apple-touch-icon-57-precomposed.png" >
< / head >
2012-08-20 06:12:52 +02:00
< body data-spy = "scroll" data-target = ".bs-docs-sidebar" >
2012-06-28 08:56:00 +02:00
<!-- Navbar
================================================== -->
2012-08-20 08:01:24 +02:00
< div class = "navbar navbar-inverse navbar-fixed-top" >
2012-09-26 07:48:02 +02:00
< div class = "container" >
< button type = "button" class = "btn btn-navbar" data-toggle = "collapse" data-target = ".nav-collapse" >
< span class = "icon-bar" > < / span >
< span class = "icon-bar" > < / span >
< span class = "icon-bar" > < / span >
< / button >
< a class = "brand" href = "./index.html" > Bootstrap< / a >
< div class = "nav-collapse collapse" >
< ul class = "nav" >
< li class = "" >
< a href = "./index.html" > Home< / a >
< / li >
< li class = "" >
< a href = "./getting-started.html" > Get started< / a >
< / li >
< li class = "" >
2012-12-01 01:31:24 +01:00
< a href = "./css.html" > Core CSS< / a >
2012-09-26 07:48:02 +02:00
< / li >
< li class = "" >
< a href = "./components.html" > Components< / a >
< / li >
< li class = "" >
< a href = "./javascript.html" > JavaScript< / a >
< / li >
< li class = "" >
< a href = "./customize.html" > Customize< / a >
< / li >
2012-12-05 05:30:21 +01:00
< li class = "" >
< a href = "./gallery.html" > Gallery< / a >
< / li >
2012-09-26 07:48:02 +02:00
< / ul >
2012-06-28 08:56:00 +02:00
< / div >
< / div >
< / div >
2012-07-10 07:25:00 +02:00
<!-- Subhead
2012-06-28 08:56:00 +02:00
================================================== -->
< header class = "jumbotron subhead" id = "overview" >
2012-07-13 03:11:49 +02:00
< div class = "container" >
< h1 > Extending Bootstrap< / h1 >
< p class = "lead" > Extend Bootstrap to take advantage of included styles and components, as well as LESS variables and mixins.< / p >
< div >
2012-06-28 08:56:00 +02:00
< / header >
2012-07-24 10:53:32 +02:00
< div class = "container" >
2012-06-28 08:56:00 +02:00
2012-07-24 10:53:32 +02:00
<!-- Docs nav
================================================== -->
< div class = "row" >
< div class = "span3 bs-docs-sidebar" >
2012-08-15 06:06:08 +02:00
< ul class = "nav nav-list bs-docs-sidenav" >
2012-11-04 00:18:02 +01:00
< li > < a href = "#built-with-less" > < i class = "glyphicon-chevron-right" > < / i > Built with LESS< / a > < / li >
< li > < a href = "#compiling" > < i class = "glyphicon-chevron-right" > < / i > Compiling Bootstrap< / a > < / li >
< li > < a href = "#static-assets" > < i class = "glyphicon-chevron-right" > < / i > Use as static assets< / a > < / li >
2012-07-24 10:53:32 +02:00
< / ul >
< / div >
< div class = "span9" >
2012-06-28 08:56:00 +02:00
2012-07-13 20:17:22 +02:00
2012-07-24 10:53:32 +02:00
<!-- BUILT WITH LESS
================================================== -->
< section id = "built-with-less" >
< div class = "page-header" >
< h1 > Built with LESS< / h1 >
< / div >
2012-06-28 08:56:00 +02:00
2012-07-24 10:53:32 +02:00
< img style = "float: right; height: 36px; margin: 10px 20px 20px" src = "assets/img/less-logo-large.png" alt = "LESS CSS" >
< p class = "lead" > Bootstrap is made with LESS at its 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.< / p >
2012-06-28 08:56:00 +02:00
2012-07-24 10:53:32 +02:00
< h3 > Why LESS?< / h3 >
< p > One of Bootstrap's creators wrote a quick < a href = "http://www.wordsbyf.at/2012/03/08/why-less/" > blog post about this< / a > , summarized here:< / p >
< ul >
< li > Bootstrap compiles faster ~6x faster with Less compared to Sass< / li >
< li > Less is written in JavaScript, making it easier to us to dive in and patch compared to Ruby with Sass.< / li >
< li > Less is more; we want to feel like we're writing CSS and making Bootstrap approachable to all.< / li >
< / ul >
2012-06-28 08:56:00 +02:00
2012-07-24 10:53:32 +02:00
< 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 >
2012-06-28 08:56:00 +02:00
2012-07-24 10:53:32 +02:00
< h3 > Learn more< / h3 >
< p > Visit the official website at < a href = "http://lesscss.org" > http://lesscss.org< / a > to learn more.< / p >
< / section >
2012-06-28 08:56:00 +02:00
2012-07-13 20:17:22 +02:00
2012-07-24 10:53:32 +02:00
<!-- COMPILING LESS AND BOOTSTRAP
================================================== -->
< section id = "compiling" >
< div class = "page-header" >
< h1 > Compiling Bootstrap with Less< / h1 >
< / div >
2012-07-10 07:25:00 +02:00
2012-07-24 10:53:32 +02:00
< p class = "lead" > Since our CSS is written with Less and utilizes variables and mixins, it needs to be compiled for final production implementation. Here's how.< / p >
2012-07-10 07:25:00 +02:00
2012-07-24 10:53:32 +02:00
< div class = "alert alert-info" >
< 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 >
2012-06-28 08:56:00 +02:00
2012-07-24 10:53:32 +02:00
< 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 < 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).< / p >
2012-07-10 07:25:00 +02:00
2012-07-24 10:53:32 +02:00
< h3 > Command line< / h3 >
< p > Install the LESS command line tool via Node and run the following command:< / p >
< pre > $ lessc ./less/bootstrap.less > bootstrap.css< / pre >
< p > Be sure to include < code > --compress< / code > in that command if you're trying to save some bytes!< / p >
2012-09-14 15:06:15 +02:00
< h3 > JavaScript< / h3 >
2012-07-24 10:53:32 +02:00
< p > < a href = "http://lesscss.org/" > Download the latest Less.js< / a > and include the path to it (and Bootstrap) in the < code > < head> < / code > .< / p >
2012-07-10 07:29:53 +02:00
< pre class = "prettyprint" >
< link rel="stylesheet/less" href="/path/to/bootstrap.less">
< script src="/path/to/less.js"> < /script>
< / pre >
2012-07-24 10:53:32 +02:00
< p > To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.< / p >
2012-07-10 07:25:00 +02:00
2012-07-24 10:53:32 +02:00
< h3 > Unofficial Mac app< / h3 >
< p > < 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. If you like, you can toggle preferences in the app for automatic minifying and which directory the compiled files end up in.< / p >
2012-07-10 07:25:00 +02:00
2012-07-24 10:53:32 +02:00
< h3 > More apps< / h3 >
< h4 > < a href = "http://crunchapp.net/" target = "_blank" > Crunch< / a > < / h4 >
< p > Crunch is a great looking LESS editor and compiler built on Adobe Air.< / p >
< h4 > < a href = "http://incident57.com/codekit/" target = "_blank" > CodeKit< / a > < / h4 >
< p > Created by the same guy as the unofficial Mac app, CodeKit is a Mac app that compiles LESS, SASS, Stylus, and CoffeeScript.< / p >
< h4 > < a href = "http://wearekiss.com/simpless" target = "_blank" > Simpless< / a > < / h4 >
< p > Mac, Linux, and Windows 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 > .< / p >
2012-07-10 07:25:00 +02:00
2012-07-24 10:53:32 +02:00
< / section >
2012-07-10 07:25:00 +02:00
2012-07-24 10:53:32 +02:00
<!-- Static assets
================================================== -->
< section id = "static-assets" >
< div class = "page-header" >
< h1 > Use as static assets< / h1 >
< / div >
< p class = "lead" > < a href = "./getting-started.html" > Quickly start< / a > any web project by dropping in the compiled or minified CSS and JS. Layer on custom styles separately for easy upgrades and maintenance moving forward.< / p >
2012-07-13 23:20:25 +02:00
2012-07-24 10:53:32 +02:00
< h3 > Setup file structure< / h3 >
< p > Download the latest compiled Bootstrap and place into your project. For example, you might have something like this:< / p >
2012-09-14 15:06:15 +02:00
< pre >
< span class = "icon-folder-open" > < / span > app/
< span class = "icon-folder-open" > < / span > layouts/
< span class = "icon-folder-open" > < / span > templates/
< span class = "icon-folder-open" > < / span > public/
< span class = "icon-folder-open" > < / span > css/
< span class = "icon-file" > < / span > bootstrap.min.css
< span class = "icon-folder-open" > < / span > js/
< span class = "icon-file" > < / span > bootstrap.min.js
< span class = "icon-folder-open" > < / span > img/
< span class = "icon-file" > < / span > glyphicons-halflings.png
< span class = "icon-file" > < / span > glyphicons-halflings-white.png
2012-07-13 23:20:25 +02:00
< / pre >
2012-07-24 10:53:32 +02:00
< h3 > Utilize starter template< / h3 >
< p > Copy the following base HTML to get started.< / p >
2012-07-13 23:20:25 +02:00
< pre class = "prettyprint linenums" >
< html>
< head>
< title> Bootstrap 101 Template< /title>
< !-- Bootstrap -->
< link href="public/css/bootstrap.min.css" rel="stylesheet">
< /head>
< body>
< h1> Hello, world!< /h1>
2012-07-18 07:19:02 +02:00
< !-- Bootstrap -->
< script src="public/js/bootstrap.min.js"> < /script>
2012-07-13 23:20:25 +02:00
< /body>
< /html>
< / pre >
2012-07-24 10:53:32 +02:00
< h3 > Layer on custom code< / h3 >
< p > Work in your custom CSS, JS, and more as necessary to make Bootstrap your own with your own separate CSS and JS files.< / p >
2012-07-13 23:20:25 +02:00
< pre class = "prettyprint linenums" >
< html>
< head>
< title> Bootstrap 101 Template< /title>
< !-- Bootstrap -->
< link href="public/css/bootstrap.min.css" rel="stylesheet">
< !-- Project -->
< link href="public/css/application.css" rel="stylesheet">
< /head>
< body>
< h1> Hello, world!< /h1>
2012-07-18 07:19:02 +02:00
< !-- Bootstrap -->
< script src="public/js/bootstrap.min.js"> < /script>
< !-- Project -->
< script src="public/js/application.js"> < /script>
2012-07-13 23:20:25 +02:00
< /body>
< /html>
< / pre >
2012-07-24 10:53:32 +02:00
< / section >
2012-07-10 07:29:53 +02:00
2012-07-24 10:53:32 +02:00
< / div >
2012-07-13 03:11:49 +02:00
< / div >
2012-07-24 10:53:32 +02:00
2012-07-10 07:25:00 +02:00
< / div >
2012-06-28 08:56:00 +02:00
2012-07-18 05:57:20 +02:00
2012-07-13 02:02:55 +02:00
2012-08-02 04:00:25 +02:00
<!-- Footer
================================================== -->
< footer class = "footer" >
< div class = "container" >
2012-12-01 22:47:07 +01:00
< div class = "bs-docs-social" >
< ul class = "bs-docs-social-buttons" >
< li >
< iframe class = "github-btn" src = "http://ghbtns.com/github-btn.html?user=twitter&repo=bootstrap&type=watch&count=true" allowtransparency = "true" frameborder = "0" scrolling = "0" width = "100px" height = "20px" > < / iframe >
< / li >
< li >
< iframe class = "github-btn" src = "http://ghbtns.com/github-btn.html?user=twitter&repo=bootstrap&type=fork&count=true" allowtransparency = "true" frameborder = "0" scrolling = "0" width = "102px" height = "20px" > < / iframe >
< / li >
< li class = "follow-btn" >
< a href = "https://twitter.com/twbootstrap" class = "twitter-follow-button" data-link-color = "#0069D6" data-show-count = "true" > Follow @twbootstrap< / a >
< / li >
< li class = "tweet-btn" >
< a href = "https://twitter.com/share" class = "twitter-share-button" data-url = "http://twitter.github.com/bootstrap/" data-count = "horizontal" data-via = "twbootstrap" data-related = "mdo:Creator of Twitter Bootstrap" > Tweet< / a >
< / li >
< / ul >
< / div >
2012-10-03 02:01:18 +02:00
< p > Designed and built with all the love in the world by < a href = "http://twitter.com/mdo" target = "_blank" > @mdo< / a > and < a href = "http://twitter.com/fat" target = "_blank" > @fat< / a > .< / p >
< p > Code licensed under < a href = "http://www.apache.org/licenses/LICENSE-2.0" target = "_blank" > Apache License v2.0< / a > , documentation under < a href = "http://creativecommons.org/licenses/by/3.0/" > CC BY 3.0< / a > .< / p >
< p > < a href = "http://glyphicons.com" > Glyphicons Free< / a > licensed under < a href = "http://creativecommons.org/licenses/by/3.0/" > CC BY 3.0< / a > .< / p >
2012-08-02 04:00:25 +02:00
< ul class = "footer-links" >
2012-10-03 02:01:18 +02:00
< li > < a href = "http://blog.getbootstrap.com" > Blog< / a > < / li >
< li class = "muted" > · < / li >
< li > < a href = "https://github.com/twitter/bootstrap/issues?state=open" > Issues< / a > < / li >
< li class = "muted" > · < / li >
2012-08-02 04:00:25 +02:00
< li > < a href = "https://github.com/twitter/bootstrap/wiki" > Roadmap and changelog< / a > < / li >
< / ul >
< / div >
< / footer >
2012-06-28 08:56:00 +02:00
2012-08-02 04:00:25 +02:00
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
< script type = "text/javascript" src = "http://platform.twitter.com/widgets.js" > < / script >
< script src = "assets/js/jquery.js" > < / script >
< script src = "assets/js/bootstrap-transition.js" > < / script >
< script src = "assets/js/bootstrap-alert.js" > < / script >
< script src = "assets/js/bootstrap-modal.js" > < / script >
< script src = "assets/js/bootstrap-dropdown.js" > < / script >
< script src = "assets/js/bootstrap-scrollspy.js" > < / script >
< script src = "assets/js/bootstrap-tab.js" > < / script >
< script src = "assets/js/bootstrap-tooltip.js" > < / script >
< script src = "assets/js/bootstrap-popover.js" > < / script >
< script src = "assets/js/bootstrap-button.js" > < / script >
< script src = "assets/js/bootstrap-collapse.js" > < / script >
< script src = "assets/js/bootstrap-carousel.js" > < / script >
< script src = "assets/js/bootstrap-typeahead.js" > < / script >
< script src = "assets/js/bootstrap-affix.js" > < / script >
2012-11-30 05:59:14 +01:00
< script src = "assets/js/holder/holder.js" > < / script >
< script src = "assets/js/google-code-prettify/prettify.js" > < / script >
2012-08-02 04:00:25 +02:00
< script src = "assets/js/application.js" > < / script >
2012-06-28 08:56:00 +02:00
< / body >
< / html >