middleman-targets 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +18 -0
  5. data/LICENSE.md +22 -0
  6. data/README.md +110 -0
  7. data/Rakefile +10 -0
  8. data/bin/middleman-targets +80 -0
  9. data/documentation_project/.gitignore +25 -0
  10. data/documentation_project/Gemfile +14 -0
  11. data/documentation_project/README.md +13 -0
  12. data/documentation_project/config.rb +123 -0
  13. data/documentation_project/source/frontmatter.html.md.erb +70 -0
  14. data/documentation_project/source/helpers-resources.html.md.erb +98 -0
  15. data/documentation_project/source/images/free-logo-small.png +0 -0
  16. data/documentation_project/source/images/free-logo-small@2x.png +0 -0
  17. data/documentation_project/source/images/free-logo.png +0 -0
  18. data/documentation_project/source/images/free-logo@2x.png +0 -0
  19. data/documentation_project/source/images/pro-logo-small.png +0 -0
  20. data/documentation_project/source/images/pro-logo-small@2x.png +0 -0
  21. data/documentation_project/source/images/pro-logo.png +0 -0
  22. data/documentation_project/source/images/pro-logo@2x.png +0 -0
  23. data/documentation_project/source/index.html.md.erb +59 -0
  24. data/documentation_project/source/javascripts/all.js +1 -0
  25. data/documentation_project/source/layouts/layout.haml +9 -0
  26. data/documentation_project/source/layouts/template-logo-large.haml +17 -0
  27. data/documentation_project/source/layouts/template-logo-medium.haml +14 -0
  28. data/documentation_project/source/layouts/template-logo-small.haml +11 -0
  29. data/documentation_project/source/only-free.html.md.erb +38 -0
  30. data/documentation_project/source/only-pro.html.md.erb +39 -0
  31. data/documentation_project/source/simple-demo.html.md.erb +183 -0
  32. data/documentation_project/source/stylesheets/_github.scss +61 -0
  33. data/documentation_project/source/stylesheets/_middlemac_minimal.scss +516 -0
  34. data/documentation_project/source/stylesheets/_normalize.scss +374 -0
  35. data/documentation_project/source/stylesheets/style.css.scss +3 -0
  36. data/documentation_project/source/target-feature-config.html.md.erb +153 -0
  37. data/lib/middleman-targets.rb +13 -0
  38. data/lib/middleman-targets/commands.rb +6 -0
  39. data/lib/middleman-targets/extension.rb +281 -0
  40. data/lib/middleman-targets/version.rb +5 -0
  41. data/middleman-targets.gemspec +26 -0
  42. metadata +126 -0
@@ -0,0 +1,374 @@
1
+ /*! normalize.css v2.0.1 | MIT License | git.io/normalize */
2
+
3
+ /* ==========================================================================
4
+ HTML5 display definitions
5
+ ========================================================================== */
6
+
7
+ /*
8
+ * Corrects `block` display not defined in IE 8/9.
9
+ */
10
+
11
+ article,
12
+ aside,
13
+ details,
14
+ figcaption,
15
+ figure,
16
+ footer,
17
+ header,
18
+ nav,
19
+ section,
20
+ summary {
21
+ display: block;
22
+ }
23
+
24
+ /*
25
+ * Corrects `inline-block` display not defined in IE 8/9.
26
+ */
27
+
28
+ audio,
29
+ canvas,
30
+ video {
31
+ display: inline-block;
32
+ }
33
+
34
+ /*
35
+ * Prevents modern browsers from displaying `audio` without controls.
36
+ * Remove excess height in iOS 5 devices.
37
+ */
38
+
39
+ audio:not([controls]) {
40
+ display: none;
41
+ height: 0;
42
+ }
43
+
44
+ /*
45
+ * Addresses styling for `hidden` attribute not present in IE 8/9.
46
+ */
47
+
48
+ [hidden] {
49
+ display: none;
50
+ }
51
+
52
+ /* ==========================================================================
53
+ Base
54
+ ========================================================================== */
55
+
56
+ /*
57
+ * 1. Sets default font family to sans-serif.
58
+ * 2. Prevents iOS text size adjust after orientation change, without disabling
59
+ * user zoom.
60
+ */
61
+
62
+ html {
63
+ font-family: sans-serif; /* 1 */
64
+ -webkit-text-size-adjust: 100%; /* 2 */
65
+ -ms-text-size-adjust: 100%; /* 2 */
66
+ }
67
+
68
+ /*
69
+ * Removes default margin.
70
+ */
71
+
72
+ body {
73
+ margin: 0;
74
+ }
75
+
76
+ /* ==========================================================================
77
+ Links
78
+ ========================================================================== */
79
+
80
+ /*
81
+ * Addresses `outline` inconsistency between Chrome and other browsers.
82
+ */
83
+
84
+ a:focus {
85
+ outline: thin dotted;
86
+ }
87
+
88
+ /*
89
+ * Improves readability when focused and also mouse hovered in all browsers.
90
+ */
91
+
92
+ a:active,
93
+ a:hover {
94
+ outline: 0;
95
+ }
96
+
97
+ /* ==========================================================================
98
+ Typography
99
+ ========================================================================== */
100
+
101
+ /*
102
+ * Addresses `h1` font sizes within `section` and `article` in Firefox 4+,
103
+ * Safari 5, and Chrome.
104
+ */
105
+
106
+ h1 {
107
+ font-size: 2em;
108
+ }
109
+
110
+ /*
111
+ * Addresses styling not present in IE 8/9, Safari 5, and Chrome.
112
+ */
113
+
114
+ abbr[title] {
115
+ border-bottom: 1px dotted;
116
+ }
117
+
118
+ /*
119
+ * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
120
+ */
121
+
122
+ b,
123
+ strong {
124
+ font-weight: bold;
125
+ }
126
+
127
+ /*
128
+ * Addresses styling not present in Safari 5 and Chrome.
129
+ */
130
+
131
+ dfn {
132
+ font-style: italic;
133
+ }
134
+
135
+ /*
136
+ * Addresses styling not present in IE 8/9.
137
+ */
138
+
139
+ mark {
140
+ background: #ff0;
141
+ color: #000;
142
+ }
143
+
144
+
145
+ /*
146
+ * Corrects font family set oddly in Safari 5 and Chrome.
147
+ */
148
+
149
+ code,
150
+ kbd,
151
+ pre,
152
+ samp {
153
+ font-family: monospace, serif;
154
+ font-size: 1em;
155
+ }
156
+
157
+ /*
158
+ * Improves readability of pre-formatted text in all browsers.
159
+ */
160
+
161
+ pre {
162
+ white-space: pre;
163
+ white-space: pre-wrap;
164
+ word-wrap: break-word;
165
+ }
166
+
167
+ /*
168
+ * Sets consistent quote types.
169
+ */
170
+
171
+ q {
172
+ quotes: "\201C" "\201D" "\2018" "\2019";
173
+ }
174
+
175
+ /*
176
+ * Addresses inconsistent and variable font size in all browsers.
177
+ */
178
+
179
+ small {
180
+ font-size: 80%;
181
+ }
182
+
183
+ /*
184
+ * Prevents `sub` and `sup` affecting `line-height` in all browsers.
185
+ */
186
+
187
+ sub,
188
+ sup {
189
+ font-size: 75%;
190
+ line-height: 0;
191
+ position: relative;
192
+ vertical-align: baseline;
193
+ }
194
+
195
+ sup {
196
+ top: -0.5em;
197
+ }
198
+
199
+ sub {
200
+ bottom: -0.25em;
201
+ }
202
+
203
+ /* ==========================================================================
204
+ Embedded content
205
+ ========================================================================== */
206
+
207
+ /*
208
+ * Removes border when inside `a` element in IE 8/9.
209
+ */
210
+
211
+ img {
212
+ border: 0;
213
+ }
214
+
215
+ /*
216
+ * Corrects overflow displayed oddly in IE 9.
217
+ */
218
+
219
+ svg:not(:root) {
220
+ overflow: hidden;
221
+ }
222
+
223
+ /* ==========================================================================
224
+ Figures
225
+ ========================================================================== */
226
+
227
+ /*
228
+ * Addresses margin not present in IE 8/9 and Safari 5.
229
+ */
230
+
231
+ figure {
232
+ margin: 0;
233
+ }
234
+
235
+ /* ==========================================================================
236
+ Forms
237
+ ========================================================================== */
238
+
239
+ /*
240
+ * Define consistent border, margin, and padding.
241
+ */
242
+
243
+ fieldset {
244
+ border: 1px solid #c0c0c0;
245
+ margin: 0 2px;
246
+ padding: 0.35em 0.625em 0.75em;
247
+ }
248
+
249
+ /*
250
+ * 1. Corrects color not being inherited in IE 8/9.
251
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
252
+ */
253
+
254
+ legend {
255
+ border: 0; /* 1 */
256
+ padding: 0; /* 2 */
257
+ }
258
+
259
+ /*
260
+ * 1. Corrects font family not being inherited in all browsers.
261
+ * 2. Corrects font size not being inherited in all browsers.
262
+ * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome
263
+ */
264
+
265
+ button,
266
+ input,
267
+ select,
268
+ textarea {
269
+ font-family: inherit; /* 1 */
270
+ font-size: 100%; /* 2 */
271
+ margin: 0; /* 3 */
272
+ }
273
+
274
+ /*
275
+ * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in
276
+ * the UA stylesheet.
277
+ */
278
+
279
+ button,
280
+ input {
281
+ line-height: normal;
282
+ }
283
+
284
+ /*
285
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
286
+ * and `video` controls.
287
+ * 2. Corrects inability to style clickable `input` types in iOS.
288
+ * 3. Improves usability and consistency of cursor style between image-type
289
+ * `input` and others.
290
+ */
291
+
292
+ button,
293
+ html input[type="button"], /* 1 */
294
+ input[type="reset"],
295
+ input[type="submit"] {
296
+ -webkit-appearance: button; /* 2 */
297
+ cursor: pointer; /* 3 */
298
+ }
299
+
300
+ /*
301
+ * Re-set default cursor for disabled elements.
302
+ */
303
+
304
+ button[disabled],
305
+ input[disabled] {
306
+ cursor: default;
307
+ }
308
+
309
+ /*
310
+ * 1. Addresses box sizing set to `content-box` in IE 8/9.
311
+ * 2. Removes excess padding in IE 8/9.
312
+ */
313
+
314
+ input[type="checkbox"],
315
+ input[type="radio"] {
316
+ box-sizing: border-box; /* 1 */
317
+ padding: 0; /* 2 */
318
+ }
319
+
320
+ /*
321
+ * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
322
+ * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
323
+ * (include `-moz` to future-proof).
324
+ */
325
+
326
+ input[type="search"] {
327
+ -webkit-appearance: textfield; /* 1 */
328
+ -moz-box-sizing: content-box;
329
+ -webkit-box-sizing: content-box; /* 2 */
330
+ box-sizing: content-box;
331
+ }
332
+
333
+ /*
334
+ * Removes inner padding and search cancel button in Safari 5 and Chrome
335
+ * on OS X.
336
+ */
337
+
338
+ input[type="search"]::-webkit-search-cancel-button,
339
+ input[type="search"]::-webkit-search-decoration {
340
+ -webkit-appearance: none;
341
+ }
342
+
343
+ /*
344
+ * Removes inner padding and border in Firefox 4+.
345
+ */
346
+
347
+ button::-moz-focus-inner,
348
+ input::-moz-focus-inner {
349
+ border: 0;
350
+ padding: 0;
351
+ }
352
+
353
+ /*
354
+ * 1. Removes default vertical scrollbar in IE 8/9.
355
+ * 2. Improves readability and alignment in all browsers.
356
+ */
357
+
358
+ textarea {
359
+ overflow: auto; /* 1 */
360
+ vertical-align: top; /* 2 */
361
+ }
362
+
363
+ /* ==========================================================================
364
+ Tables
365
+ ========================================================================== */
366
+
367
+ /*
368
+ * Remove most spacing between table cells.
369
+ */
370
+
371
+ table {
372
+ border-collapse: collapse;
373
+ border-spacing: 0;
374
+ }
@@ -0,0 +1,3 @@
1
+ @import "normalize"; // keep normalize in case deployment to non Help Center.
2
+ @import "middlemac_minimal"; // basic styles.
3
+ @import "github"; // styles used for code blocks.
@@ -0,0 +1,153 @@
1
+ ---
2
+ title: Configuration
3
+ layout: template-logo-medium
4
+ ---
5
+
6
+ # Configuration
7
+
8
+ Configuring `middleman-targets` is done in the standard Middleman `config.rb`
9
+ file using a few simple options that are added to Middleman.
10
+
11
+ If you’re used to most Middleman extensions you may be familiar with setting
12
+ extension options in a `do` block when activating the extension. Please note
13
+ that `middleman-targets` extends Middleman itself; the new options must _not_
14
+ be specified in the activation block!
15
+ {:.note}
16
+
17
+ ## Activation
18
+
19
+ As with most Middleman extensions, `middleman-targets` must be activated before
20
+ use. Simply add
21
+
22
+ ~~~ ruby
23
+ activate :MiddlemanTargets
24
+ ~~~
25
+
26
+ to your `config.rb` file.
27
+
28
+ ### Activation Conflicts
29
+
30
+ `middleman-targets` enhances the `image_tag` helper, and as such it expects to
31
+ be able to inherit from other `image_tag` helpers in order to do its job
32
+ completely. If you use other extensions that enhance the `image_tag` helper,
33
+ such as `automatic_image_sizes` or `automatic_alt_tags`, ensure that you
34
+ activate them _before_ activating `middleman-targets`.
35
+
36
+ ## The Configuration Options
37
+
38
+ `target`
39
+
40
+ : This is the target that is used automatically when you `middleman build`
41
+ or `middleman server` without using the `--targets` option from the
42
+ command line.
43
+
44
+ `targets`
45
+
46
+ : The `targets` key is a comprehensive list of your targets, their features,
47
+ and other data pertinent to your targets.
48
+
49
+ All of the keys contained in this structure are described in the next
50
+ section, below.
51
+
52
+ `target_magic_images`
53
+ `target_magic_word`
54
+
55
+ : By enabling `target_magic_images` and using `middleman-targets`’ image
56
+ helper, target specific images will be used instead of the image you
57
+ specify, *if* that image name is prefixed with `target_magic_word`. For
58
+ example, you might request `all-my_image.png`, and `pro-my_image.png` (if it
59
+ exists) will be used in your :pro target instead.
60
+
61
+ Important: when this is enabled, images from *other* targets will *not* be
62
+ included in the build! In the example above, *any* image prefixed with
63
+ `free-` would not be included in the output directory.
64
+
65
+ `build_dir`
66
+
67
+ : Build output will use this directory as a *prefix*; if the target
68
+ is `:pro`, then the actual build directory will be `build (pro)/`. If the
69
+ `build_dir` key is present for any of the `targets`, they will override this
70
+ setting.
71
+
72
+ ## The `targets` key by example
73
+
74
+ The code below is the actual `targets` key for this sample project. We’ll look
75
+ at the sub-keys and their values to understand how targets and features are
76
+ defined, and how you can effect your build output directory as well as add
77
+ other arbitrary data to each target.
78
+
79
+ ~~~ ruby
80
+ set :targets, {
81
+ :free =>
82
+ {
83
+ :sample_key => 'People who use free versions don\'t drive profits.',
84
+ :build_dir => 'build (%s)',
85
+ :features =>
86
+ {
87
+ :feature_advertise_pro => true,
88
+ :insults_user => true,
89
+ :grants_wishes => false,
90
+ }
91
+ },
92
+
93
+ :pro =>
94
+ {
95
+ :sample_key => 'You are a valued contributor to our balance sheet!',
96
+ :features =>
97
+ {
98
+ :feature_advertise_pro => false,
99
+ :insults_user => false,
100
+ :grants_wishes => true,
101
+ }
102
+ },
103
+ }
104
+ ~~~
105
+
106
+ ### Each `targets`
107
+
108
+ Looking at the top level of this structure you can see that there are two
109
+ targets defined: `free` and `pro`. Nested within each of them are a series of
110
+ additional keys.
111
+
112
+ `sample_key`
113
+
114
+ : This is an example data key associated with each target. You can specify as
115
+ many as you wish using any naming convention that suits you. Target-specific
116
+ values can be retrieved in your pages using the `target_value`
117
+ [helper](helpers-resources.html).
118
+
119
+ `build_dir`
120
+
121
+ : When used for a target then this specified directory overrides the Middleman
122
+ `build_dir` setting. Note that in this project only the `free` target
123
+ specifies a `build_dir`; it is optional. The `pro` target, lacking a
124
+ `build_dir` key will default to the `middleman-targets` option setting.
125
+
126
+ You can use a specific string for this setting, or optionally you can include
127
+ a single `%s` **sprintf** placeholder which will be filled with the target
128
+ name during build, as shown in this example.
129
+
130
+ `features`
131
+
132
+ : This key is where you define the features that are pertinent to each of your
133
+ targets, as well as enable or disable them.
134
+
135
+ You can add as many features as you like, and the names can be any valid
136
+ Ruby symbol.
137
+
138
+ Although not precisely required, it’s an excellent best practice to add
139
+ _every_ feature to _all_ of your targets, as is done in this sample project.
140
+ They can be enabled and disabled simply by toggling their values between
141
+ `true` and `false`.
142
+
143
+
144
+
145
+ <% content_for :seeAlso do %>
146
+ <ul>
147
+ <li><a href="index.html">Welcome to middleman-targets</a></li>
148
+ <li><a href="simple-demo.html">Simple features demonstration</a></li>
149
+ <li><a href="build-serve-targets.html">Build and Serve different targets</a></li>
150
+ <li><a href="helpers-resources.html">Helpers and Resources</a></li>
151
+ <li><a href="frontmatter.html">Front Matter</a></li>
152
+ </ul>
153
+ <% end %>