-
Notifications
You must be signed in to change notification settings - Fork 4
/
extend.html.haml
151 lines (131 loc) · 6.68 KB
/
extend.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
layout: base
style: community
title: Extend
---
%header.jumbotron.subhead#overview
%h1 Extending Bootstrap
%p.lead Extend Bootstrap to take advantage of included styles and components, as well as LESS variables and mixins.
.row
.span3.bs-docs-sidebar
%ul.nav.nav-list.bs-docs-sidenav
%li<
%a(href="#built-with-less")<
%i.icon-chevron-right
Built with LESS
%li<
%a(href="#compiling")<
%i.icon-chevron-right
Compiling Bootstrap
%li<
%a(href="#static-assets")<
%i.icon-chevron-right
Use as static assets
.span9
%section#built-with-less
.page-header
%h1 Built with LESS
%img(style="float: right; height: 36px; margin: 10px 20px 20px" src="assets/img/less-logo-large.png" alt="LESS CSS")
%p.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.
%h3 Why LESS?
%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:
%ul
%li Bootstrap compiles faster ~6x faster with Less compared to Sass
%li Less is written in JavaScript, making it easier to us to dive in and patch compared to Ruby with Sass.
%li Less is more; we want to feel like we're writing CSS and making Bootstrap approachable to all.
%h3 What's included?
%p As an extension of CSS, LESS includes variables, mixins for reusable snippets of code, operations for simple math, nesting, and even color functions.
%h3 Learn more
%p Visit the official website at <a href="http://lesscss.org">http://lesscss.org</a> to learn more.
%section#compiling
.page-header
%h1 Compiling Bootstrap with Less
%p.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.
.alert.alert-info
:markdown
**Note:** If you're submitting a pull request to GitHub with modified CSS, you **must** recompile the CSS via any of these methods.
%h2 Tools for compiling
%h3 Node with makefile
%p Install the LESS command line compiler, JSHint, Recess, and uglify-js globally with npm by running the following command:
%pre $ npm install -g less jshint recess uglify-js
%p Once installed just run <code>make</code> from the root of your bootstrap directory and you're all set.
%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).
%h3 Command line
%p Install the LESS command line tool via Node and run the following command:
%pre $ lessc ./less/bootstrap.less > bootstrap.css
%p Be sure to include <code>--compress</code> in that command if you're trying to save some bytes!
%h3 JavaScript
%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>.
%pre.prettyprint
= preserve do
:escaped
<link rel="stylesheet/less" href="/path/to/bootstrap.less">
<script src="/path/to/less.js"><;/script>
%p To recompile the .less files, just save them and reload your page. Less.js compiles them and stores them in local storage.
%h3 Unofficial Mac app
%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.
%h3 More apps
%h4 <a href="http://crunchapp.net/" target="_blank">Crunch</a>
%p Crunch is a great looking LESS editor and compiler built on Adobe Air.
%h4 <a href="http://incident57.com/codekit/" target="_blank">CodeKit</a>
%p Created by the same guy as the unofficial Mac app, CodeKit is a Mac app that compiles LESS, SASS, Stylus, and CoffeeScript.
%h4 <a href="http://wearekiss.com/simpless" target="_blank">Simpless</a>
%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>.
%section#static-assets
.page-header
%h1 Use as static assets
%p.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.
%h3 Setup file structure
%p Download the latest compiled Bootstrap and place into your project. For example, you might have something like this:
%pre
= preserve do
:plain
<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
%h3 Utilize starter template
%p Copy the following base HTML to get started.
%pre.prettyprint.linenums
= preserve do
:escaped
<html>
<head>
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="public/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<h1>Hello, world!</h1>
<!-- Bootstrap -->
<script src="public/js/bootstrap.min.js"></script>
</body>
</html>
%h3 Layer on custom code
%p Work in your custom CSS, JS, and more as necessary to make Bootstrap your own with your own separate CSS and JS files.
%pre.prettyprint.linenums
= preserve do
:escaped
<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>
<!-- Bootstrap -->
<script src="public/js/bootstrap.min.js"></script>
<!-- Project -->
<script src="public/js/application.js"></script>
</body>
</html>