Skip to content
This repository was archived by the owner on Sep 12, 2023. It is now read-only.

Commit 677591c

Browse files
committedJun 13, 2013
add search
1 parent 3368cba commit 677591c

File tree

7 files changed

+68
-24
lines changed

7 files changed

+68
-24
lines changed
 

‎Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ gem "redcarpet"
44
gem "builder"
55
gem "susy"
66
gem "middleman", "3.1.0.rc.4"
7-
gem "middleman-fjords"
7+
gem "middleman-fjords"
8+
gem "middleman-livereload"

‎config.rb

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set :layout, :article
44

5+
activate :livereload
6+
57
activate :directory_indexes
68

79
set :markdown, :tables => true, :autolink => true, :gh_blockcode => true, :fenced_code_blocks => true, :with_toc_data => true

‎source/advanced/file-size-optimization.html.markdown

+1-20
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,7 @@ Then configure your server to serve those files. If you use Nginx, check out [th
4646

4747
## Compressing Images
4848

49-
If you also want to compress images on build, you can use the [Middleman Smusher extension] to dramatically shrink images using [Yahoo's Smush.it tool], though it's probably a better idea to compress your images once using a tool like [PNGGauntlet](http://pnggauntlet.com) or [ImageOptim](http://imageoptim.pornel.net) rather than every time you build your site.
50-
51-
To install:
52-
53-
``` bash
54-
gem install middleman-smusher
55-
```
56-
57-
Then activate in your `config.rb`:
58-
59-
``` ruby
60-
configure :build do
61-
activate :smusher
62-
end
63-
```
64-
65-
It's slightly harder to set up, but [`middleman-imageoptim`](https://github.com/plasticine/middleman-imageoptim) is faster and compresses better than `middleman-smusher`, and it doesn't require sending your images to a web service.
49+
If you also want to compress images on build, try [`middleman-imageoptim`](https://github.com/plasticine/middleman-imageoptim).
6650

6751
## Minify HTML
6852

@@ -79,6 +63,3 @@ activate :minify_html
7963
```
8064

8165
You should notice whilst view-source:'ing that your HTML is now being minified.
82-
83-
[Middleman Smusher extension]: https://github.com/middleman/middleman-smusher
84-
[Yahoo's Smush.it tool]: http://www.smushit.com/ysmush.it/

‎source/index.html.erb

+24
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,30 @@ layout: layout
1010
<section role="main">
1111
<div id="install">
1212
<p><b class="console">$ gem install middleman</b></p>
13+
14+
<div id="search">
15+
<form>
16+
<input type="text" id="st-search-input" class="st-search-input" placeholder="Search the documentation" />
17+
</form>
18+
<div id="st-results-container"></div>
19+
<script type="text/javascript">
20+
var Swiftype = window.Swiftype || {};
21+
(function() {
22+
Swiftype.key = 'q3qjGN5LmX2oq6w1V47y';
23+
Swiftype.inputElement = '#st-search-input';
24+
Swiftype.resultContainingElement = '#st-results-container';
25+
Swiftype.attachElement = '#st-search-input';
26+
Swiftype.renderStyle = "overlay";
27+
28+
var script = document.createElement('script');
29+
script.type = 'text/javascript';
30+
script.async = true;
31+
script.src = "//swiftype.com/embed.js";
32+
var entry = document.getElementsByTagName('script')[0];
33+
entry.parentNode.insertBefore(script, entry);
34+
}());
35+
</script>
36+
</div>
1337
</div>
1438

1539
<div class="container">

‎source/layouts/article.erb

+24
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
<div class="container">
44
<h1><%= link_to image_tag("mm-blue-w-text.svg", :width => 225, :height => 225, :alt => "Middleman"), "/", { :class => 'logo' } %></h1>
55
<p class="console">$ gem install middleman</p>
6+
<div id="search">
7+
<form>
8+
<input type="text" id="st-search-input" class="st-search-input" placeholder="Search the documentation" />
9+
</form>
10+
<div id="st-results-container"></div>
11+
<script type="text/javascript">
12+
var Swiftype = window.Swiftype || {};
13+
(function() {
14+
Swiftype.key = 'q3qjGN5LmX2oq6w1V47y';
15+
Swiftype.inputElement = '#st-search-input';
16+
Swiftype.resultContainingElement = '#st-results-container';
17+
Swiftype.attachElement = '#st-search-input';
18+
Swiftype.renderStyle = "overlay";
19+
20+
var script = document.createElement('script');
21+
script.type = 'text/javascript';
22+
script.async = true;
23+
script.src = "//swiftype.com/embed.js";
24+
var entry = document.getElementsByTagName('script')[0];
25+
entry.parentNode.insertBefore(script, entry);
26+
}());
27+
</script>
28+
</div>
29+
630
<a class="toc-nav-link icon-arrow-down" href="#toc">Menu</a>
731
</div>
832
</header>

‎source/stylesheets/_articles.scss

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
bottom: -35px;
1010
}
1111
p {
12-
@include span-columns(17);
12+
@include span-columns(10);
1313
@include push(6);
1414
font-family: $display-monospace-font-family;
1515
margin-top: 14px;
@@ -22,6 +22,11 @@
2222
.toc-nav-link {
2323
display: none;
2424
}
25+
#search {
26+
@include span-columns(7);
27+
text-align: right;
28+
margin-top: 9px;
29+
}
2530
}
2631

2732
#toc {

‎source/stylesheets/_mediaqueries.scss

+9-2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
b {
6969
font-size: 24px;
7070
}
71+
#search {
72+
display: none;
73+
}
7174
}
7275
.grid {
7376
.toc-block {
@@ -92,7 +95,11 @@
9295
@media screen and ( max-width: $two-column ) {
9396
#header {
9497
p {
95-
text-align: right;
98+
display: none;
99+
}
100+
#search {
101+
@include span-columns(24);
102+
margin: 9px 0;
96103
}
97104
}
98105
#toc {
@@ -124,7 +131,7 @@
124131
}
125132
}
126133
}
127-
p {
134+
p, #search {
128135
display: none;
129136
}
130137
.toc-nav-link {

0 commit comments

Comments
 (0)
This repository has been archived.