tennpipes-init 3.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.rdoc +163 -0
  4. data/Rakefile +1 -0
  5. data/bin/tennpipes-init +16 -0
  6. data/lib/tennpipes-init.rb +73 -0
  7. data/lib/tennpipes-init/command.rb +18 -0
  8. data/lib/tennpipes-init/generators/actions.rb +630 -0
  9. data/lib/tennpipes-init/generators/app.rb +75 -0
  10. data/lib/tennpipes-init/generators/app/app.rb.tt +72 -0
  11. data/lib/tennpipes-init/generators/app/app.rb.tt~ +72 -0
  12. data/lib/tennpipes-init/generators/cli.rb +57 -0
  13. data/lib/tennpipes-init/generators/component.rb +73 -0
  14. data/lib/tennpipes-init/generators/components/actions.rb +208 -0
  15. data/lib/tennpipes-init/generators/components/mocks/mocha.rb +10 -0
  16. data/lib/tennpipes-init/generators/components/mocks/rr.rb +13 -0
  17. data/lib/tennpipes-init/generators/components/orms/activerecord.rb +201 -0
  18. data/lib/tennpipes-init/generators/components/orms/couchrest.rb +55 -0
  19. data/lib/tennpipes-init/generators/components/orms/datamapper.rb +140 -0
  20. data/lib/tennpipes-init/generators/components/orms/dynamoid.rb +67 -0
  21. data/lib/tennpipes-init/generators/components/orms/minirecord.rb +165 -0
  22. data/lib/tennpipes-init/generators/components/orms/mongoid.rb +113 -0
  23. data/lib/tennpipes-init/generators/components/orms/mongomapper.rb +43 -0
  24. data/lib/tennpipes-init/generators/components/orms/mongomatic.rb +84 -0
  25. data/lib/tennpipes-init/generators/components/orms/ohm.rb +65 -0
  26. data/lib/tennpipes-init/generators/components/orms/ripple.rb +75 -0
  27. data/lib/tennpipes-init/generators/components/orms/sequel.rb +99 -0
  28. data/lib/tennpipes-init/generators/components/renderers/erb.rb +3 -0
  29. data/lib/tennpipes-init/generators/components/renderers/haml.rb +3 -0
  30. data/lib/tennpipes-init/generators/components/renderers/liquid.rb +4 -0
  31. data/lib/tennpipes-init/generators/components/renderers/slim.rb +3 -0
  32. data/lib/tennpipes-init/generators/components/scripts/dojo.rb +10 -0
  33. data/lib/tennpipes-init/generators/components/scripts/extcore.rb +10 -0
  34. data/lib/tennpipes-init/generators/components/scripts/jquery.rb +10 -0
  35. data/lib/tennpipes-init/generators/components/scripts/mootools.rb +10 -0
  36. data/lib/tennpipes-init/generators/components/scripts/prototype.rb +12 -0
  37. data/lib/tennpipes-init/generators/components/scripts/rightjs.rb +10 -0
  38. data/lib/tennpipes-init/generators/components/stylesheets/compass.rb +39 -0
  39. data/lib/tennpipes-init/generators/components/stylesheets/compass/application.scss +43 -0
  40. data/lib/tennpipes-init/generators/components/stylesheets/compass/partials/_base.scss +12 -0
  41. data/lib/tennpipes-init/generators/components/stylesheets/less.rb +25 -0
  42. data/lib/tennpipes-init/generators/components/stylesheets/sass.rb +15 -0
  43. data/lib/tennpipes-init/generators/components/stylesheets/scss.rb +16 -0
  44. data/lib/tennpipes-init/generators/components/tests/bacon.rb +103 -0
  45. data/lib/tennpipes-init/generators/components/tests/cucumber.rb +86 -0
  46. data/lib/tennpipes-init/generators/components/tests/minitest.rb +110 -0
  47. data/lib/tennpipes-init/generators/components/tests/riot.rb +117 -0
  48. data/lib/tennpipes-init/generators/components/tests/rspec.rb +111 -0
  49. data/lib/tennpipes-init/generators/components/tests/shoulda.rb +114 -0
  50. data/lib/tennpipes-init/generators/components/tests/steak.rb +114 -0
  51. data/lib/tennpipes-init/generators/controller.rb +77 -0
  52. data/lib/tennpipes-init/generators/helper.rb +50 -0
  53. data/lib/tennpipes-init/generators/mailer.rb +52 -0
  54. data/lib/tennpipes-init/generators/migration.rb +43 -0
  55. data/lib/tennpipes-init/generators/model.rb +113 -0
  56. data/lib/tennpipes-init/generators/plugin.rb +67 -0
  57. data/lib/tennpipes-init/generators/project.rb +160 -0
  58. data/lib/tennpipes-init/generators/project/config.ru +9 -0
  59. data/lib/tennpipes-init/generators/project/config/apps.rb.tt +35 -0
  60. data/lib/tennpipes-init/generators/project/config/boot.rb +49 -0
  61. data/lib/tennpipes-init/generators/project/public/favicon.ico +0 -0
  62. data/lib/tennpipes-init/generators/project/public/images/booking.com.png +0 -0
  63. data/lib/tennpipes-init/generators/project/public/images/causes.png +0 -0
  64. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bg.jpg +0 -0
  65. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.png +0 -0
  66. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.svg +68 -0
  67. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.png +0 -0
  68. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.svg +65 -0
  69. data/lib/tennpipes-init/generators/project/public/images/forever21.png +0 -0
  70. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.eot +0 -0
  71. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.svg +970 -0
  72. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.ttf +0 -0
  73. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.woff +0 -0
  74. data/lib/tennpipes-init/generators/project/public/images/icons/tennpipes-icons.css +598 -0
  75. data/lib/tennpipes-init/generators/project/public/images/image1.jpg +0 -0
  76. data/lib/tennpipes-init/generators/project/public/images/image11.jpg +0 -0
  77. data/lib/tennpipes-init/generators/project/public/images/image2.jpg +0 -0
  78. data/lib/tennpipes-init/generators/project/public/images/image3.jpg +0 -0
  79. data/lib/tennpipes-init/generators/project/public/images/intuit.png +0 -0
  80. data/lib/tennpipes-init/generators/project/public/images/krispykreme.png +0 -0
  81. data/lib/tennpipes-init/generators/project/public/images/placeholders/README.md +302 -0
  82. data/lib/tennpipes-init/generators/project/public/images/placeholders/bower.json +4 -0
  83. data/lib/tennpipes-init/generators/project/public/images/placeholders/composer.json +34 -0
  84. data/lib/tennpipes-init/generators/project/public/images/placeholders/gulpfile.js +92 -0
  85. data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.js +1920 -0
  86. data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.min.js +12 -0
  87. data/lib/tennpipes-init/generators/project/public/images/placeholders/package.json +46 -0
  88. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/holder.js +1411 -0
  89. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/augment.js +27 -0
  90. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/ondomready.js +155 -0
  91. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/polyfills.js +177 -0
  92. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/scenegraph.js +101 -0
  93. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/utils.js +129 -0
  94. data/lib/tennpipes-init/generators/project/public/images/priceline.com.png +0 -0
  95. data/lib/tennpipes-init/generators/project/public/images/stripe.png +0 -0
  96. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes.min.js +6081 -0
  97. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.abide.js +340 -0
  98. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.accordion.js +67 -0
  99. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.alert.js +43 -0
  100. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.clearing.js +556 -0
  101. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.dropdown.js +448 -0
  102. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.equalizer.js +77 -0
  103. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.interchange.js +354 -0
  104. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.joyride.js +932 -0
  105. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.js +703 -0
  106. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.magellan.js +203 -0
  107. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.offcanvas.js +152 -0
  108. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.orbit.js +476 -0
  109. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.reveal.js +471 -0
  110. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.slider.js +263 -0
  111. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tab.js +237 -0
  112. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tooltip.js +307 -0
  113. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.topbar.js +452 -0
  114. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/fastclick.js +8 -0
  115. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.cookie.js +8 -0
  116. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.js +26 -0
  117. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/modernizr.js +8 -0
  118. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/placeholder.js +2 -0
  119. data/lib/tennpipes-init/generators/project/public/stylesheets/app.css~ +178 -0
  120. data/lib/tennpipes-init/generators/project/public/stylesheets/app1.css~ +177 -0
  121. data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css +214 -0
  122. data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css~ +214 -0
  123. data/lib/tennpipes-init/generators/project/public/stylesheets/normalize.css +427 -0
  124. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css +6201 -0
  125. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css~ +6201 -0
  126. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.min.css +1 -0
  127. data/lib/tennpipes-init/generators/runner.rb +139 -0
  128. data/lib/tennpipes-init/generators/task.rb +45 -0
  129. data/lib/tennpipes-init/generators/templates/Gemfile.tt +32 -0
  130. data/lib/tennpipes-init/generators/templates/Rakefile.tt +8 -0
  131. data/lib/tennpipes-init/generators/templates/controller.rb.tt +22 -0
  132. data/lib/tennpipes-init/generators/templates/gem/README.md.tt +29 -0
  133. data/lib/tennpipes-init/generators/templates/gem/gemspec.tt +19 -0
  134. data/lib/tennpipes-init/generators/templates/gem/lib/libname.tt +6 -0
  135. data/lib/tennpipes-init/generators/templates/gem/lib/libname/version.tt +3 -0
  136. data/lib/tennpipes-init/generators/templates/helper.rb.tt +13 -0
  137. data/lib/tennpipes-init/generators/templates/initializer.rb.tt +5 -0
  138. data/lib/tennpipes-init/generators/templates/mailer.rb.tt +54 -0
  139. data/lib/tennpipes-init/generators/templates/project_bin.tt +14 -0
  140. data/lib/tennpipes-init/generators/templates/task.rb.tt +7 -0
  141. data/lib/tennpipes-init/tennpipes-tasks/activerecord.rb +377 -0
  142. data/lib/tennpipes-init/tennpipes-tasks/database.rb +12 -0
  143. data/lib/tennpipes-init/tennpipes-tasks/datamapper.rb +94 -0
  144. data/lib/tennpipes-init/tennpipes-tasks/minirecord.rb +19 -0
  145. data/lib/tennpipes-init/tennpipes-tasks/mongoid.rb +215 -0
  146. data/lib/tennpipes-init/tennpipes-tasks/mongomapper.rb +55 -0
  147. data/lib/tennpipes-init/tennpipes-tasks/sequel.rb +85 -0
  148. data/lib/tennpipes-init/tennpipes-tasks/sql-helpers.rb +72 -0
  149. data/test/fixtures/admin_template.rb +7 -0
  150. data/test/fixtures/example_template.rb +15 -0
  151. data/test/fixtures/git_template.rb +4 -0
  152. data/test/fixtures/plugin_template.rb +13 -0
  153. data/test/fixtures/rake_template.rb +9 -0
  154. data/test/helper.rb +103 -0
  155. data/test/test_app_generator.rb +142 -0
  156. data/test/test_cli.rb +27 -0
  157. data/test/test_component_generator.rb +98 -0
  158. data/test/test_controller_generator.rb +272 -0
  159. data/test/test_generator.rb +13 -0
  160. data/test/test_helper_generator.rb +133 -0
  161. data/test/test_mailer_generator.rb +69 -0
  162. data/test/test_migration_generator.rb +222 -0
  163. data/test/test_model_generator.rb +553 -0
  164. data/test/test_plugin_generator.rb +152 -0
  165. data/test/test_project_generator.rb +757 -0
  166. data/test/test_task_generator.rb +53 -0
  167. metadata +285 -0
@@ -0,0 +1,302 @@
1
+ # Holder
2
+
3
+ ![](http://imsky.github.io/holder/images/header.png)
4
+
5
+ Holder renders image placeholders on the client side using SVG.
6
+
7
+ Used by [Bootstrap](http://getbootstrap.com), thousands of [open source projects](https://github.com/search?q=holder.js+in%3Apath&type=Code&ref=searchresults), and [many other sites](https://search.nerdydata.com/search/#!/searchTerm=holder.js/searchPage=1/sort=pop).
8
+
9
+ ## Installing
10
+
11
+ * [npm](http://npmjs.com/): `npm install holderjs`
12
+ * [Bower](http://bower.io/): `bower install holderjs`
13
+ * [cdnjs](http://cdnjs.com/): <http://cdnjs.com/libraries/holder>
14
+ * [jsDelivr](http://www.jsdelivr.com): <http://www.jsdelivr.com/#!holder>
15
+ * [Rails Assets](https://rails-assets.org): `gem 'rails-assets-holderjs'`
16
+ * [Meteor](http://atmospherejs.com/): `meteor add holder`
17
+ * [Composer](https://packagist.org/): `php composer.phar update imsky/holder`
18
+ * [NuGet](http://www.nuget.org/): `Install-Package Holder.js`
19
+
20
+ ## Usage
21
+
22
+ Include ``holder.js`` in your HTML:
23
+
24
+ ```html
25
+ <script src="holder.js"></script>
26
+ ```
27
+
28
+ Holder will then process all images with a specific ``src`` attribute, like this one:
29
+
30
+ ```html
31
+ <img src="holder.js/200x300">
32
+ ```
33
+
34
+ The above tag will render as a placeholder 200 pixels wide and 300 pixels tall.
35
+
36
+ To avoid console 404 errors, you can use ``data-src`` instead of ``src``.
37
+
38
+ ## Themes
39
+
40
+ ![](http://imsky.github.io/holder/images/holder_sky.png)![](http://imsky.github.io/holder/images/holder_vine.png)![](http://imsky.github.io/holder/images/holder_lava.png)
41
+
42
+ Holder includes support for themes, to help placeholders blend in with your layout.
43
+
44
+ There are 6 default themes: ``sky``, ``vine``, ``lava``, ``gray``, ``industrial``, and ``social``. Use them like so:
45
+
46
+ ```html
47
+ <img src="holder.js/200x300/sky">
48
+ ```
49
+
50
+ ## Customizing appearance
51
+
52
+ There are several settings that can be used to change the appearance of a placeholder without using a theme.
53
+
54
+ ### Custom colors
55
+
56
+ Custom colors on a specific image can be specified in the ``background:foreground`` format using hex notation, like this:
57
+
58
+ ```html
59
+ <img data-src="holder.js/100x200/#000:#fff">
60
+ ```
61
+
62
+ The above will render a placeholder with a black background and white text.
63
+
64
+ ### Custom text
65
+
66
+ You can specify custom text using the ``text:`` operator:
67
+
68
+ ```html
69
+ <img data-src="holder.js/200x200/text:hello world">
70
+ ```
71
+
72
+ If you have a group of placeholders where you'd like to use particular text, you can do so by adding a ``text`` property to the theme:
73
+
74
+ ```js
75
+ Holder.addTheme("thumbnail", { background: "#fff", text: "Thumbnail" });
76
+ ```
77
+
78
+ Holder automatically adds line breaks to text that goes outside of the image boundaries. If the text is so long it goes out of both horizontal and vertical boundaries, the text is moved to the top. If you prefer to control the line breaks, you can add `\n` to the `text` property:
79
+
80
+ ```html
81
+ <img data-src="holder.js/300x200/text:Add \n line breaks \n anywhere.">
82
+ ```
83
+ ### Custom size
84
+
85
+ Font size for placeholders is set automatically, however you can set a custom font size by using the ``size`` flag:
86
+
87
+ ```html
88
+ <img data-src="holder.js/300x200/size:40">
89
+ ```
90
+
91
+ ### Custom fonts, web fonts and icon fonts
92
+
93
+ You can set a placeholder's font either through a theme or through the `font` flag:
94
+
95
+ ```html
96
+ <img data-src="holder.js/300x200/font:Helvetica">
97
+ ```
98
+
99
+ Placeholders using a custom font are rendered using canvas by default, due to SVG's constraints on cross-domain resource linking. If you're using only locally available fonts, you can disable this behavior by setting `noFontFallback` to `true` in `Holder.run` options. However, if you need to render a SVG placeholder using an externally loaded font, you have to use the `object` tag instead of the `img` tag and add a `holderjs` class to the appropriate `link` tags. Here's an example:
100
+
101
+ ```html
102
+ <head>
103
+ <link href="http://.../font-awesome.css" rel="stylesheet" class="holderjs">
104
+ </head>
105
+ <body>
106
+ <object data-src="holder.js/300x200/font:FontAwesome"></object>
107
+ ```
108
+
109
+ **Important:** When testing locally, font URLs must have a `http` or `https` protocol defined.
110
+
111
+ `<object>` placeholders work like `<img>` placeholders, with the added benefit of their DOM being able to be inspected and modified. As with `<img>` placeholders, the `data-src` attribute is more reliable than the `data` attribute.
112
+
113
+
114
+ ## Customizing themes
115
+
116
+ Themes have 5 properties: ``foreground``, ``background``, ``size``, ``font`` and ``fontweight``. The ``size`` property specifies the minimum font size for the theme. The ``fontweight`` default value is ``bold``. You can create a sample theme like this:
117
+
118
+ ```js
119
+ Holder.addTheme("dark", {
120
+ background: "#000",
121
+ foreground: "#aaa",
122
+ size: 11,
123
+ font: "Monaco",
124
+ fontweight: "normal"
125
+ });
126
+ ```
127
+
128
+ ## Using custom themes
129
+
130
+ There are two ways to use custom themes with Holder:
131
+
132
+ * Include theme at runtime to render placeholders already using the theme name
133
+ * Include theme at any point and re-render placeholders that are using the theme name
134
+
135
+ The first approach is the easiest. After you include ``holder.js``, add a ``script`` tag that adds the theme you want:
136
+
137
+ ```html
138
+ <script src="holder.js"></script>
139
+ <script>
140
+ Holder.addTheme("bright", {
141
+ background: "white", foreground: "gray", size: 12
142
+ });
143
+ </script>
144
+ ```
145
+
146
+ The second approach requires that you call ``run`` after you add the theme, like this:
147
+
148
+ ```js
149
+ Holder.addTheme("bright", {background: "white", foreground: "gray", size: 12}).run();
150
+ ```
151
+
152
+ ## Using custom themes and domain on specific images
153
+
154
+ You can use Holder in different areas on different images with custom themes:
155
+
156
+ ```html
157
+ <img data-src="example.com/100x100/simple" id="new">
158
+ ```
159
+
160
+ ```js
161
+ Holder.run({
162
+ domain: "example.com",
163
+ themes: {
164
+ "simple": {
165
+ background: "#fff",
166
+ foreground: "#000",
167
+ size: 12
168
+ }
169
+ },
170
+ images: "#new"
171
+ });
172
+ ```
173
+
174
+ ## Random themes
175
+
176
+ You can render a placeholder with a random theme using the `random` flag:
177
+ ```html
178
+ <img data-src="holder.js/300x200/random">
179
+ ```
180
+
181
+ ## Fluid placeholders
182
+
183
+ Specifying a dimension in percentages creates a fluid placeholder that responds to media queries.
184
+
185
+ ```html
186
+ <img data-src="holder.js/100%x75/social">
187
+ ```
188
+
189
+ By default, the fluid placeholder will show its current size in pixels. To display the original dimensions, i.e. 100%x75, set the ``textmode`` flag to ``literal`` like so: `holder.js/100%x75/textmode:literal`.
190
+
191
+ ## Automatically sized placeholders
192
+
193
+ If you'd like to avoid Holder enforcing an image size, use the ``auto`` flag like so:
194
+
195
+ ```html
196
+ <img data-src="holder.js/200x200/auto">
197
+ ```
198
+
199
+ The above will render a placeholder without any embedded CSS for height or width.
200
+
201
+ To show the current size of an automatically sized placeholder, set the ``textmode`` flag to ``exact`` like so: `holder.js/200x200/auto/textmode:exact`.
202
+
203
+ ## Preventing updates on window resize
204
+
205
+ Both fluid placeholders and automatically sized placeholders in exact mode are updated when the window is resized. To set whether or not a particular image is updated on window resize, you can use the `setResizeUpdate` method like so:
206
+
207
+ ```js
208
+ var img = $('#placeholder').get(0);
209
+ Holder.setResizeUpdate(img, false);
210
+ ```
211
+
212
+ The above will pause any render updates on the specified image (which must be a DOM object).
213
+
214
+ To enable updates again, run the following:
215
+
216
+ ```js
217
+ Holder.setResizeUpdate(img, true);
218
+ ```
219
+
220
+ This will enable updates and immediately render the placeholder.
221
+
222
+ ## Background placeholders
223
+
224
+ Holder can render placeholders as background images for elements with the `holderjs` class, like this:
225
+
226
+ ```css
227
+ #sample {background:url(?holder.js/200x200/social) no-repeat}
228
+ ```
229
+
230
+ ```html
231
+ <div id="sample" class="holderjs"></div>
232
+ ```
233
+
234
+ The Holder URL in CSS should have a `?` in front. Like in image placeholders, you can specify the Holder URL in a `data-background-src` attribute:
235
+
236
+ ```html
237
+ <div data-background-src="?holder.js/300x200"></div>
238
+ ```
239
+
240
+ **Important:** Make sure to define a height and/or width for elements with background placeholders. Fluid background placeholders are not yet supported.
241
+
242
+ **Important:** Some browsers can't parse URLs like `?holder.js/300x200/#fff:#000` due to the `#` characters. You can use `^` in place of `#` like this: `?holder.js/300x200/^fff:^000`.
243
+
244
+ ## Custom settings
245
+
246
+ Holder extends its default settings with the settings you provide, so you only have to include those settings you want changed. For example, you can run Holder on a specific domain like this:
247
+
248
+ ```js
249
+ Holder.run({domain:"example.com"});
250
+ ```
251
+
252
+ ## Using custom settings on load
253
+
254
+ You can prevent Holder from running its default configuration by executing ``Holder.run`` with your custom settings right after including ``holder.js``. However, you'll have to execute ``Holder.run`` again to render any placeholders that use the default configuration.
255
+
256
+ ## Inserting an image with optional custom theme
257
+
258
+ You can add a placeholder programmatically by chaining Holder calls:
259
+
260
+ ```js
261
+ Holder.addTheme("new", {
262
+ foreground: "#ccc",
263
+ background: "#000",
264
+ size: 10
265
+ }).addImage("holder.js/200x100/new", "body").run();
266
+ ```
267
+
268
+ The first argument in ``addImage`` is the ``src`` attribute, and the second is a CSS selector of the parent element.
269
+
270
+ ## Using different renderers
271
+
272
+ Holder has three renderers: canvas, SVG, and HTML. The SVG renderer is used by default, however you can set the renderer using the `renderer` option, with either `svg`, `canvas`, or `html` values.
273
+
274
+ ```js
275
+ Holder.run({renderer: 'canvas'});
276
+ ```
277
+
278
+ ## Using with [lazyload.js](https://github.com/tuupola/jquery_lazyload)
279
+
280
+
281
+ Holder is compatible with ``lazyload.js`` and works with both fluid and fixed-width images. For best results, run `.lazyload({skip_invisible:false})`.
282
+
283
+ ## Using with Angular.js
284
+
285
+ You can use Holder in Angular projects with [ng-holder](https://github.com/joshvillbrandt/ng-holder).
286
+
287
+ ## Browser support
288
+
289
+ * Chrome
290
+ * Firefox 3+
291
+ * Safari 4+
292
+ * Internet Explorer 9+ (with partial support for 6-8)
293
+ * Opera 15+ (with partial support for 12)
294
+ * Android (with fallback)
295
+
296
+ ## License
297
+
298
+ Holder is provided under the [MIT License](http://opensource.org/licenses/MIT).
299
+
300
+ ## Credits
301
+
302
+ Holder is a project by [Ivan Malopinsky](http://imsky.co).
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "holderjs",
3
+ "main": "holder.js"
4
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "imsky/holder",
3
+ "description": "Client-side image placeholders.",
4
+ "homepage": "http://holderjs.com",
5
+ "keywords": [
6
+ "images",
7
+ "placeholders",
8
+ "client-side",
9
+ "canvas",
10
+ "generation",
11
+ "development"
12
+ ],
13
+ "license": "MIT",
14
+ "type": "component",
15
+ "authors": [
16
+ {
17
+ "name": "Ivan Malopinsky",
18
+ "homepage": "http://imsky.co"
19
+ }
20
+ ],
21
+ "require": {
22
+ "robloach/component-installer": "*"
23
+ },
24
+ "extra": {
25
+ "component": {
26
+ "scripts": [
27
+ "holder.js"
28
+ ],
29
+ "files": [
30
+ "holder.min.js"
31
+ ]
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,92 @@
1
+ var gulp = require('gulp');
2
+ var concat = require('gulp-concat');
3
+ var uglify = require('gulp-uglifyjs');
4
+ var header = require('gulp-header');
5
+ var jshint = require('gulp-jshint');
6
+ var todo = require('gulp-todo');
7
+ var gulputil = require('gulp-util');
8
+ var replace = require('gulp-replace');
9
+ var webpack = require('gulp-webpack');
10
+ var beautify = require('gulp-jsbeautifier');
11
+
12
+ var moment = require('moment');
13
+ var pkg = require('./package.json');
14
+
15
+ var banner =
16
+ '/*!\n\n' +
17
+ '<%= pkg.officialName %> - <%= pkg.summary %>\nVersion <%= pkg.version %>+<%= build %>\n' +
18
+ '\u00A9 <%= year %> <%= pkg.author.name %> - <%= pkg.author.url %>\n\n' +
19
+ 'Site: <%= pkg.homepage %>\n'+
20
+ 'Issues: <%= pkg.bugs.url %>\n' +
21
+ 'License: <%= pkg.license.url %>\n\n' +
22
+ '*/\n';
23
+
24
+ function generateBuild(){
25
+ var date = new Date;
26
+ return Math.floor((date - (new Date(date.getFullYear(),0,0)))/1000).toString(36)
27
+ }
28
+
29
+ var build = generateBuild();
30
+
31
+ gulp.task('jshint', ['beautify'], function () {
32
+ return gulp.src('src/**/*.js')
33
+ .pipe(jshint())
34
+ .pipe(jshint.reporter('default'));
35
+ });
36
+
37
+ gulp.task('todo', function(){
38
+ return gulp.src('src/holder.js')
39
+ .pipe(todo())
40
+ .pipe(gulp.dest('./'));
41
+ });
42
+
43
+ gulp.task('build', ['jshint'], function () {
44
+ return gulp.src('src/holder.js')
45
+ .pipe(webpack({
46
+ output: {
47
+ library: 'Holder',
48
+ filename: 'holder.js',
49
+ libraryTarget: 'umd'
50
+ }
51
+ }))
52
+ .pipe(gulp.dest('./'));
53
+ });
54
+
55
+ gulp.task('bundle', ['build'], function () {
56
+ return gulp.src(['src/polyfills.js', 'holder.js'])
57
+ .pipe(concat('holder.js'))
58
+ .pipe(gulp.dest('./'));
59
+
60
+ });
61
+
62
+ gulp.task('minify', ['bundle'], function () {
63
+ return gulp.src("holder.js")
64
+ .pipe(uglify("holder.min.js"))
65
+ .pipe(gulp.dest("./"));
66
+ });
67
+
68
+ gulp.task('banner', ['minify'], function () {
69
+ return gulp.src(["holder*.js"])
70
+ .pipe(replace('%version%', pkg.version))
71
+ .pipe(header(banner, {
72
+ pkg: pkg,
73
+ year: moment().format("YYYY"),
74
+ build: build
75
+ }))
76
+ .pipe(gulp.dest("./"));
77
+ });
78
+
79
+ gulp.task('beautify', function () {
80
+ return gulp.src(['src/*.js'])
81
+ .pipe(beautify())
82
+ .pipe(gulp.dest('src/'));
83
+ });
84
+
85
+ gulp.task('watch', function(){
86
+ gulp.watch('src/*.js', ['default']);
87
+ });
88
+
89
+ gulp.task('default', ['todo', 'bundle', 'minify', 'banner'], function(){
90
+ gulputil.log("Finished build "+build);
91
+ build = generateBuild();
92
+ });