jekyll-assets 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +2 -1
  3. data/LICENSE +1 -1
  4. data/README.md +136 -149
  5. data/Rakefile +37 -5
  6. data/lib/jekyll-assets.rb +1 -1
  7. data/lib/jekyll/assets.rb +14 -3
  8. data/lib/jekyll/assets/config.rb +1 -1
  9. data/lib/jekyll/assets/context.rb +1 -1
  10. data/lib/jekyll/assets/default.rb +1 -1
  11. data/lib/jekyll/assets/drop.rb +1 -1
  12. data/lib/jekyll/assets/env.rb +52 -19
  13. data/lib/jekyll/assets/extensible.rb +1 -1
  14. data/lib/jekyll/assets/filters.rb +1 -1
  15. data/lib/jekyll/assets/hook.rb +31 -3
  16. data/lib/jekyll/assets/html.rb +1 -1
  17. data/lib/jekyll/assets/logger.rb +52 -10
  18. data/lib/jekyll/assets/manifest.rb +1 -1
  19. data/lib/jekyll/assets/map.rb +2 -2
  20. data/lib/jekyll/assets/map/css.rb +1 -1
  21. data/lib/jekyll/assets/map/javascript.rb +1 -1
  22. data/lib/jekyll/assets/map/writer.rb +2 -2
  23. data/lib/jekyll/assets/patches/asset.rb +1 -1
  24. data/lib/jekyll/assets/patches/cached.rb +4 -4
  25. data/lib/jekyll/assets/patches/find_asset.rb +1 -1
  26. data/lib/jekyll/assets/patches/functions.rb +1 -1
  27. data/lib/jekyll/assets/patches/obsolete.rb +1 -1
  28. data/lib/jekyll/assets/patches/site.rb +1 -1
  29. data/lib/jekyll/assets/plugins.rb +1 -1
  30. data/lib/jekyll/assets/plugins/bootstrap.rb +3 -3
  31. data/lib/jekyll/assets/plugins/closure_comments.rb +32 -0
  32. data/lib/jekyll/assets/plugins/font-awesome.rb +2 -2
  33. data/lib/jekyll/assets/plugins/frontmatter.rb +1 -1
  34. data/lib/jekyll/assets/plugins/html/audio.rb +1 -1
  35. data/lib/jekyll/assets/plugins/html/component.rb +1 -1
  36. data/lib/jekyll/assets/plugins/html/css.rb +1 -1
  37. data/lib/jekyll/assets/plugins/html/defaults/audio.rb +1 -1
  38. data/lib/jekyll/assets/plugins/html/defaults/component.rb +1 -1
  39. data/lib/jekyll/assets/plugins/html/defaults/css.rb +1 -1
  40. data/lib/jekyll/assets/plugins/html/defaults/favicon.rb +1 -1
  41. data/lib/jekyll/assets/plugins/html/defaults/img.rb +2 -2
  42. data/lib/jekyll/assets/plugins/html/defaults/js.rb +1 -1
  43. data/lib/jekyll/assets/plugins/html/defaults/vid.rb +1 -1
  44. data/lib/jekyll/assets/plugins/html/favicon.rb +1 -1
  45. data/lib/jekyll/assets/plugins/html/img.rb +2 -2
  46. data/lib/jekyll/assets/plugins/html/js.rb +1 -1
  47. data/lib/jekyll/assets/plugins/html/pic.rb +1 -1
  48. data/lib/jekyll/assets/plugins/html/svg.rb +1 -1
  49. data/lib/jekyll/assets/plugins/html/vid.rb +1 -1
  50. data/lib/jekyll/assets/plugins/liquid.rb +1 -1
  51. data/lib/jekyll/assets/plugins/magick.rb +2 -2
  52. data/lib/jekyll/assets/plugins/optim.rb +2 -2
  53. data/lib/jekyll/assets/plugins/prefixer.rb +2 -2
  54. data/lib/jekyll/assets/plugins/proxy/magick.rb +1 -1
  55. data/lib/jekyll/assets/plugins/proxy/optim.rb +1 -1
  56. data/lib/jekyll/assets/plugins/searcher.rb +17 -3
  57. data/lib/jekyll/assets/proxy.rb +1 -1
  58. data/lib/jekyll/assets/reader.rb +33 -0
  59. data/lib/jekyll/assets/tag.rb +54 -13
  60. data/lib/jekyll/assets/url.rb +2 -7
  61. data/lib/jekyll/assets/utils.rb +16 -23
  62. data/lib/jekyll/assets/version.rb +2 -2
  63. data/lib/jekyll/assets/writer.rb +46 -0
  64. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: be115b8dd928002bfc074650cc9a62eec14a31df
4
- data.tar.gz: 344c3bf4f6e574e16fd73d291a96aca5fc4cff25
2
+ SHA256:
3
+ metadata.gz: d245aff52390866323d9c7bf20d14fe63c28a0a95ae7fe535f3c6df506e7f7a5
4
+ data.tar.gz: 85d98b9f5543ea588fd5acf51d801ad98be4fa8e5b2998b6b5a279f3fdcddd46
5
5
  SHA512:
6
- metadata.gz: ef800a9dd7e4052f0719990340d05147d48346e583a25e8887a4f1c3196d070deb078ba3142e465378b4549dba960d985d5ecea7ec8dafeb2da39994e3d1faa1
7
- data.tar.gz: b6ed70b962068a68712492f40059d4b473bb259125de100f7ad94229927d3def67854d2938b6f0320b79288eb47481a4d04a57cc2df6b4adf5e2a01a6f1d0a84
6
+ metadata.gz: 92544fcdb40ca56d6b76a77e11faa199e7f2da477d597658673e504136a30ac54198dcddda36682803c6dc95ea1ded0193fbb82105210a297523e8b230ddcc00
7
+ data.tar.gz: 074e304b51a467c634c80acb05c600b698ba426e27a75f5794fb71af8968bda65979619ef1e8286c8fd543c8e4180d5ca04a4d8f434e5905451abfdfb44b0661
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # Frozen-string-literal: true
2
- # Copyright: 2012 - 2017 - MIT License
2
+ # Copyright: 2012 - 2018 - MIT License
3
3
  # Encoding: utf-8
4
4
 
5
5
  source "https://rubygems.org"
@@ -38,4 +38,5 @@ group :optionals do
38
38
  gem "mini_magick", "~> 4.2", require: false
39
39
  gem "babel-transpiler", require: false
40
40
  gem "bootstrap", require: false
41
+ gem "sassc", require: false
41
42
  end
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
  Copyright (c) 2012 - 2015 Aleksey V Zapparov (http://ixti.net/)
2
- Copyright (c) 2015 - 2017 Jordon Bedwell (https://envygeeks.io)
2
+ Copyright (c) 2015 - 2018 Jordon Bedwell (https://envygeeks.io)
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Code Climate](https://img.shields.io/codeclimate/maintainability/envygeeks/jekyll-assets.svg?style=for-the-badge)](https://codeclimate.com/github/envygeeks/jekyll-assets/maintainability)
2
- [![Code Climate](https://img.shields.io/codeclimate/coverage/github/envygeeks/jekyll-assets.svg?style=for-the-badge)](https://codeclimate.com/github/envygeeks/jekyll-assets/test_coverage)
2
+ [![Code Climate](https://img.shields.io/codeclimate/c/envygeeks/jekyll-assets.svg?style=for-the-badge)](https://codeclimate.com/github/envygeeks/jekyll-assets/coverage)
3
3
  [![Travis CI](https://img.shields.io/travis/envygeeks/jekyll-assets/master.svg?style=for-the-badge)](https://travis-ci.org/envygeeks/jekyll-assets)
4
4
  [![Donate](https://img.shields.io/badge/-DONATE-yellow.svg?style=for-the-badge)](https://www.paypal.com/donate/?token=2YE-4wLE2dSgtPaQqTlQgcD2BvKv_tkHUD7GJYs4OskLI0l6XFEAKpNc5rIG6-bAeMFdom)
5
5
  ![Gem Version](https://img.shields.io/gem/v/jekyll-assets.svg?style=for-the-badge)
@@ -7,9 +7,9 @@
7
7
 
8
8
  # Jekyll Assets
9
9
 
10
- Jekyll Assets is a drop in [asset pipeline](http://guides.rubyonrails.org/asset_pipeline.html) that uses [Sprockets](https://github.com/rails/sprockets) to build specifically for Jekyll. It utilizes [Sprockets](https://github.com/rails/sprockets), and [Jekyll](https://jekyllrb.com) to try and achieve a clean and extensible assets platform that supports plugins, caching, converting your assets, and even the proxy of said assets in a way that does not interfere with either [Sprockets](https://github.com/rails/sprockets), or [Jekyll](3), and your own source. By default you can add Jekyll Assets to your Gemfile, as a plugin, and have it act as a drop-in replacement for Jekyll's basic SASS/CoffeeScript processors, with you only having to add it to your Gemfile, and updating your `<img>`, and `<link>`.
10
+ Jekyll Assets is a drop in [asset pipeline](http://guides.rubyonrails.org/asset_pipeline.html) that uses [Sprockets](https://github.com/rails/sprockets) to build specifically for Jekyll. It utilizes [Sprockets](https://github.com/rails/sprockets), and [Jekyll](https://jekyllrb.com) to try and achieve a clean, and extensible assets platform that supports plugins, caching, converting your assets. It even supports proxying of said assets in a way that does not interfere with either [Sprockets](https://github.com/rails/sprockets), or [Jekyll](https://jekyllrb.com), or your own source. By default you can add Jekyll Assets to your Gemfile, as a plugin, and have it act as a drop-in replacement for Jekyll's basic SASS processors, with you only having to add it to your Gemfile, and updating your `<img>`, and `<link>`.
11
11
 
12
- ## Using Jekyll Assets with Jekyll
12
+ ## Installing
13
13
 
14
14
  ```ruby
15
15
  gem "jekyll-assets", group: :jekyll_plugins
@@ -17,13 +17,17 @@ gem "jekyll-assets", git: "https://github.com/envygeeks/jekyll-assets", group: :
17
17
  gem "jekyll-assets", "~> x.x.alpha", group: :jekyll_plugins
18
18
  ```
19
19
 
20
- ### Requirments
20
+ ---
21
21
 
22
- * Ruby ***2.3+***
23
- * Jekyll ***3.5+***
24
- * Sprockets ***3.3+***
22
+ ### System Requirements
25
23
 
26
- ***If you would like SourceMap support, or faster Sprockets, you should prefer to use Sprockets "~> 4.0.beta", we support SourceMaps in this version of Sprockets because it supports them. It's manifest an other features are also much better inside of this version of Sprockets.***
24
+ * `ruby`: ***2.3+***
25
+ * `sprockets`: ***3.3+***
26
+ * `jekyll`: ***3.5+***
27
+
28
+ ---
29
+
30
+ If you'd like SourceMaps, or *faster* Sprockets, opt to use Sprockets `4.0`, you can use it by placing it to your Gemfile.
27
31
 
28
32
  ```ruby
29
33
  gem "sprockets", "~> 4.0.beta", {
@@ -33,7 +37,7 @@ gem "sprockets", "~> 4.0.beta", {
33
37
 
34
38
  ## Configuration
35
39
 
36
- The configuration file is the same as Jekyll's, which is `_config.yml`. Except we use the special key "assets" inside of that file. Any environment variable noted as "val on `JEKYLL_ENV`" is only overridden when not explicitly set. All values listed below are default, you need not copy these into your configuration file unless you plan to change a value.
40
+ The configuration file is the same as Jekyll's, which is `_config.yml`. Except we use the special key called `assets` inside of that file. All values listed below are default, you need not copy these into your configuration file unless you plan to change a value. *Setting a value makes it explicit, and shared across both **production**, and **development**.*
37
41
 
38
42
  ```yaml
39
43
  source_maps: true # false on JEKYLL_ENV=production
@@ -72,59 +76,50 @@ cdn:
72
76
  # Only use this if you have more.
73
77
  # --
74
78
  sources:
75
- - assets/css
76
- - assets/fonts
77
- - assets/images
78
- - assets/videos
79
- - assets/javascript
80
- - assets/video
81
- - assets/image
82
- - assets/img
83
- - assets/js
84
- - _assets/css
85
- - _assets/fonts
86
- - _assets/images
87
- - _assets/videos
88
- - _assets/javascript
89
- - _assets/video
90
- - _assets/image
91
- - _assets/img
92
- - _assets/js
93
- - css
94
- - fonts
95
- - images
96
- - videos
97
- - javascript
98
- - video
99
- - image
100
- - img
101
- - js
79
+ - assets/css
80
+ - assets/fonts
81
+ - assets/images
82
+ - assets/videos
83
+ - assets/javascript
84
+ - assets/video
85
+ - assets/image
86
+ - assets/img
87
+ - assets/js
88
+ - _assets/css
89
+ - _assets/fonts
90
+ - _assets/images
91
+ - _assets/videos
92
+ - _assets/javascript
93
+ - _assets/video
94
+ - _assets/image
95
+ - _assets/img
96
+ - _assets/js
97
+ - css
98
+ - fonts
99
+ - images
100
+ - videos
101
+ - javascript
102
+ - video
103
+ - image
104
+ - img
105
+ - js
102
106
  plugins:
103
107
  css: { autoprefixer: {}}
104
108
  img: { optim: {}}
105
109
  ```
106
110
 
107
- ## Tag
108
- ### Usage
109
- #### Liquid
111
+ ## Tag `{% asset %}`, `<img>`
110
112
 
111
- ```liquid
113
+ ```html
112
114
  {% asset src @magick:2x alt='This is my alt' %}
113
115
  {% asset src @magick:2x alt='This is my alt' %}
114
- ```
115
-
116
- #### HTML
117
-
118
- ```html
119
116
  <img src="src" asset="@magick:2x" alt="This is my alt">
120
117
  <img src="src" alt="This is my alt" asset>
121
118
  ```
122
119
 
123
- ### Defaults
124
-
125
- We provide several defaults that get set when you run an asset, depending on content type, this could be anything from type, all the way to integrity. If there is a default attribute you do not wish to be included, you can disable the attribute with `!attribute`, and it will be skipped over.
120
+ ## Defaults
126
121
 
127
- #### Usage
122
+ We provide several defaults that get set when you run an asset, depending on content type, this could be anything from type, all the way to integrity. *If there is a default attribute you do not wish to be included, you can disable the attribute with `!attribute`, and it will be skipped over.*
128
123
 
129
124
  ```liquid
130
125
  {% asset img.png !integrity %}
@@ -135,7 +130,7 @@ We provide several defaults that get set when you run an asset, depending on con
135
130
 
136
131
  Our tags will take any number of arguments, and convert them to HTML, and even attach them to your output if the HTML processor you use accepts that kind of data. ***This applies to anything but hashes, and arrays.*** So adding say, a class, or id, is as easy as doing `id="val"` inside of your tag arguments.
137
132
 
138
- #### Builtins
133
+ #### Built In
139
134
 
140
135
  | Arg | Description | Type | Return Type |
141
136
  |---|---|---|---|
@@ -148,7 +143,7 @@ Our tags will take any number of arguments, and convert them to HTML, and even a
148
143
  | `srcset` | [Responsive]() `<img>` | `image/*` | `text/html` |
149
144
  | `srcset` + `@pic` | [Responsive]() `<pic>` | `image/*` | `text/html` |
150
145
 
151
- ***Jekyll Assets uses [@envygeeks](https://github.com/envygeeks) `liquid-tag-parser` which supports advanced arguments (hash based arguments) as well as array based arguments. When you see something like `k1:sk1=val` it will get converted to `k1 = { sk1: "val" }` in Ruby. To find out more about how we process tags you should visit the documentation for [`liquid-tag-parser`](https://github.com/envygeeks/liquid-tag-parser)***
146
+ *Jekyll Assets uses [@envygeeks](https://github.com/envygeeks) `liquid-tag-parser` which supports advanced arguments (hash based arguments) as well as array based arguments. When you see something like `k1:sk1=val` it will get converted to `k1 = { sk1: "val" }` in Ruby. To find out more about how we process tags you should visit the documentation for [`liquid-tag-parser`](https://github.com/envygeeks/liquid-tag-parser)*
152
147
 
153
148
  #### Responsive Images
154
149
 
@@ -198,29 +193,38 @@ Jekyll Assets has the concept of responsive images, using the `picture` (when us
198
193
 
199
194
  ##### Args
200
195
 
201
- | Arg | Type | Description | `@pic` Only |
202
- | --- | ---- | ------------| ----------- |
203
- | `width` | Width [Density] | Resize, set `srcset="<Src> <<Width>px/Density>"` | ✗ |
204
- | `min-width` | Width [Density] | Resize, set `media="(min-width: <Width>px)"` | ✔ |
205
- | `max-width` | Width [Density] | Resize, set `media="(max-width: <Width>px)"` | ✔ |
206
- | `sizes` | Any | Your value, unaltered, unparsed. | ✗ |
207
- | `media` | Any | Your value, unaltered, unparsed. | ✗ |
196
+ | Arg | Type | Description | `@pic` Only |
197
+ | ----------- | --------------- | ---------------------------------------- | ----------- |
198
+ | `width` | Width [Density] | Resize, set `srcset="<Src> <<Width>px/Density>"` | ✗ |
199
+ | `min-width` | Width [Density] | Resize, set `media="(min-width: <Width>px)"` | ✔ |
200
+ | `max-width` | Width [Density] | Resize, set `media="(max-width: <Width>px)"` | ✔ |
201
+ | `sizes` | Any | Your value, unaltered, unparsed. | ✗ |
202
+ | `media` | Any | Your value, unaltered, unparsed. | ✗ |
208
203
 
209
- ***If you set `media`, w/ `max-width`, `min-width`, we will not ship `media`, we will simply resize and assume you know what you're doing. Our parser is not complex, and does not make a whole lot of assumptions on your behalf, it's simple and only meant to make your life easier. In the future we may make it more advanced.***
204
+ *If you set `media`, w/ `max-width`, `min-width`, we will not ship `media`, we will simply resize and assume you know what you're doing. Our parser is not complex, and does not make a whole lot of assumptions on your behalf, it's simple and only meant to make your life easier. In the future we may make it more advanced.*
210
205
 
211
206
  ## Liquid
212
207
 
213
- We support liquid arguments for tag values (but not tag keys), and we also support Liquid pre-processing (with your Jekyll context) of most files if they end with `.liquid`. This will also give you access to our filters as well as their filters, and Jekyll's filters.
214
-
215
- ### Usage
208
+ We support liquid arguments for tag values (but not tag keys), and we also support Liquid pre-processing (with your Jekyll context) of most files if they end with `.liquid`. This will also give you access to our filters as well as their filters, and Jekyll's filters, and any tags that are globally available.
216
209
 
217
210
  ```liquid
218
- {% img '{{ image_path }}' %}
219
- {% img '{{ image_path }}' proxy:key='{{ value }}' %}
220
- {% img {{\ image_path\ }} %}
211
+ {% asset '{{ site.bg_img }}' %}
212
+ {% asset '{{ site.bg_img }}' proxy:key='{{ value }}' %}
213
+ {% asset {{\ site.bg_img\ }} %}
214
+ ```
215
+
216
+ ### `.sass`, `.scss`
217
+
218
+ ```scss
219
+ body {
220
+ background-image: asset_url("'{{ site.bg_img }}'");
221
+ background-image: asset_url("'{{ site.bg_img }}' proxy:key='{{ value }}'");
222
+ background-image: asset_url("{{\ site.bg_img\ }}");
223
+ }
221
224
  ```
222
225
 
223
- #### `.liquid.ext`, and `.ext.liquid`
226
+ ### `.liquid.ext`
227
+ ### `.ext.liquid`
224
228
 
225
229
  ```scss
226
230
  .bg {
@@ -228,18 +232,16 @@ We support liquid arguments for tag values (but not tag keys), and we also suppo
228
232
  }
229
233
  ```
230
234
 
231
- You have full access to your entire Jekyll context from any liquid
232
- processing we do, so you can do whatever you like, and be as dynamic as you like, including full loops, and conditional Liquid based CSS/JavaScript since we pre-process your text files. ***On Sprockets 4.x you can use `.liquid.ext` and `.ext.liquid`, but because of the way Sprockets 3.x works, we have opted to only allow the default extension of `.ext.liquid` when running on "Old Sprockets" (AKA 3.x.) If you would like Syntax + Liquid you should opt to install Sprockets 4.x so you can get the more advanced features.***
235
+ You have full access to your entire global context from any liquid
236
+ processing we do. Depending on where you do it, you might or might not also have access to your local (page) context as well. You can also do whatever you like, and be as dynamic as you like, including full loops, and conditional Liquid, since we pre-process your text files. *On Sprockets 4.x you can use `.liquid.ext` and `.ext.liquid`, but because of the way Sprockets 3.x works, we have opted to only allow the default extension of `.ext.liquid` when running on "Old Sprockets" (AKA 3.x.) If you would like Syntax + Liquid you should opt to install Sprockets 4.x so you can get the more advanced features.*
233
237
 
234
- ##### Importing
238
+ #### Importing
235
239
 
236
240
  ***In order to import your Liquid pre-processed assets inside of Liquid or JS you should use a Sprockets `//require=`, Sprockets does not integrate that deeply into JavaScript and SASS to allow you to `@import` and pre-process.***
237
241
 
238
- ## Sass/SCSS Helpers
239
-
240
- We provide two helpers, `asset_path` to return the path of an asset, and `asset_url` which will wrap `asset_path` into a `url()` for you, making it easy for you to extract your assets and their paths inside of SCSS.
242
+ ## `.sass`, `.scss` Helpers
241
243
 
242
- ### Usage
244
+ We provide two base helpers, `asset_path` to return the path of an asset, and `asset_url` which will wrap `asset_path` into a `url()` for you, making it easy for you to extract your assets and their paths inside of SCSS. All other helpers that Sprockets themselves provide will use our `asset_path` helper, so you can use them like normal, *including with Liquid*
243
245
 
244
246
  ```scss
245
247
  body {
@@ -247,11 +249,9 @@ body {
247
249
  }
248
250
  ```
249
251
 
250
- #### Proxies, and Other Arguments
252
+ ### Proxies, and Other Arguments
251
253
 
252
- Any argument that is supported by our regular tags, is also supported by our Sass/SCSS helpers, with a few obvious exceptions (like `srcset`). This means that you can wrap your assets into `magick` if you wish, or `imageoptim` or any other proxy that is able to spit out a path for you to use.
253
-
254
- ##### Usage
254
+ Any argument that is supported by our regular tags, is also supported by our `.sass`/`.scss` helpers, with a few obvious exceptions (like `srcset`). This means that you can wrap your assets into `magick` if you wish, or `imageoptim` or any other proxy that is able to spit out a path for you to use. The general rule is, that if it returns a path, or `@data` then it's safe to use within `.scss`/`.sass`, otherwise it will probably throw.
255
255
 
256
256
  ```scss
257
257
  body {
@@ -259,11 +259,11 @@ body {
259
259
  }
260
260
  ```
261
261
 
262
- ***Not we do not validate your arguments, so if you send a conflicting argument that results in invalid CSS, you are responsible for that, in that if you ship us `srcset` we won't throw, we will spit out HTML for you, and it will break your CSS, this is by design.***
262
+ *Note: we do not validate your arguments, so if you send a conflicting argument that results in invalid CSS, you are responsible for that, in that if you ship us `srcset` we might or might not throw, depending on how the threads are ran. So it might ship HTML if you do it wrong, and it will break your CSS, this is by design so that if possible, in the future, we can allow more flexibility, or so that plugins can change based on arguments.*
263
263
 
264
264
  ## List
265
265
 
266
- We provide all *your* assets as a hash of Liquid Drops so you can get basic info that we wish you to have access to without having to prepare the class.
266
+ We provide all *your* assets as a hash of Liquid Drops so you can get basic info that we wish you to have access to without having to prepare the class. **Note:** The keys in the `assets` array are the names of the original files, e.g., use `*.scss` instead of `*.css`.
267
267
 
268
268
  ```liquid
269
269
  {{ assets["bundle.css"].content_type }} => "text/css"
@@ -273,13 +273,14 @@ We provide all *your* assets as a hash of Liquid Drops so you can get basic info
273
273
 
274
274
  The current list of available accessors:
275
275
 
276
- | Method | Description |
277
- |---|---|
278
- | `content_type` | The RFC content type |
279
- | `height` | The asset height ***(if available)*** |
280
- | `filename` | The full path to the assets actual file |
281
- | `width` | The asset width ***(if available)*** |
282
- | `digest_path` | The prefixed path |
276
+ | Method | Description |
277
+ | -------------- | --------------------------------------- |
278
+ | `content_type` | The RFC content type |
279
+ | `height` | The asset height ***(if available)*** |
280
+ | `filename` | The full path to the assets actual file |
281
+ | `width` | The asset width ***(if available)*** |
282
+ | `digest_path` | The prefixed path |
283
+ | `integrity` | The SRI hash (currently sha256) |
283
284
 
284
285
  ### Looping
285
286
 
@@ -355,15 +356,15 @@ We have basic support for WebComponents when using Sprockets `~> 4.0.0.beta`, th
355
356
 
356
357
  ## Hooks
357
358
 
358
- | Point | Name | Instance | Args |
359
- |---|---|---|---|
360
- | `:env` | `:before_init` | ✔ | ✗ |
361
- | `:env` | `:after_init` | ✔ | ✗ |
362
- | `:env` | `:after_write` | ✔ | ✗ |
363
- | `:config` | `:before_merge` | ✗ | `Config{}` |
364
- | `asset` | `:before_compile` | ✗ | `Asset`, `Manifest` |
359
+ | Point | Name | Instance | Args |
360
+ | --------- | ----------------- | -------- | ------------------- |
361
+ | `:env` | `:before_init` | ✔ | ✗ |
362
+ | `:env` | `:after_init` | ✔ | ✗ |
363
+ | `:env` | `:after_write` | ✔ | ✗ |
364
+ | `:config` | `:before_merge` | ✗ | `Config{}` |
365
+ | `asset` | `:before_compile` | ✗ | `Asset`, `Manifest` |
365
366
 
366
- ### Usage
367
+ ### Example
367
368
 
368
369
  ```ruby
369
370
  Jekyll::Assets::Hook.register :env, :before_init do
@@ -387,8 +388,6 @@ end
387
388
 
388
389
  Your plugin can also register it's own hooks on our Hook system, so that you can trigger hooks around your stuff as well, this is useful for extensive plugins that want more power.
389
390
 
390
- ##### Usage
391
-
392
391
  ```ruby
393
392
  Jekyll::Assets::Hook.add_point(:plugin, :hook)
394
393
  ```
@@ -402,28 +401,25 @@ end
402
401
 
403
402
  ## Default Plugins
404
403
  ### Font Awesome
405
- #### Installation
406
404
 
407
405
  ```ruby
408
406
  gem "font-awesome-sass"
409
407
  ```
410
408
 
411
- #### Usage
412
-
413
409
  ```scss
414
- @import "font-awesome-sprockets"
415
- @import "font-awesome"
410
+ @import "font-awesome-sprockets";
411
+ @import "font-awesome";
412
+ html {
413
+ // ...
414
+ }
416
415
  ```
417
416
 
418
417
  ### CSS Auto-Prefixing
419
- #### Installation
420
418
 
421
419
  ```ruby
422
420
  gem "autoprefixer-rails"
423
421
  ```
424
422
 
425
- #### Config
426
-
427
423
  ```yml
428
424
  assets:
429
425
  autoprefixer:
@@ -433,61 +429,52 @@ assets:
433
429
  ```
434
430
 
435
431
  ### Bootstrap
436
- #### Installation
437
-
438
- ***4.x***
439
- ```ruby
440
- gem "bootstrap"
441
- ```
442
432
 
443
- ***3.x***
444
433
  ```ruby
445
- gem "boostrap-sass"
434
+ gem "boostrap-sass" # 3.x
435
+ gem "bootstrap" # 4.x
446
436
  ```
447
437
 
448
- #### Usage
449
-
450
438
  ```scss
451
439
  @import 'bootstrap'
440
+ html {
441
+ // ...
442
+ }
452
443
  ```
453
444
 
454
445
  ### ImageMagick
455
- #### Installation
456
446
 
457
447
  ```ruby
458
448
  gem "mini_magick"
459
449
  ```
460
450
 
461
- #### Tag Args
451
+ #### Args
462
452
 
463
453
  See the [MiniMagick docs](https://github.com/minimagick/minimagick#usage)
464
454
  to get an idea what `<value>` can be.
465
455
 
466
- | Name | Accepts Value |
467
- |---|---|
468
- | `magick:compress` | ✔ |
469
- | `magick:resize` | ✔ |
470
- | `magick:format`<sup>*</sup> | ✔ |
471
- | `magick:quality` | ✔ |
472
- | `magick:rotate` | ✔ |
473
- | `magick:gravity` | ✔ |
474
- | `magick:crop` | ✔ |
475
- | `magick:flip` | ✔ |
476
- | `@magick:double` | ✗ |
477
- | `@magick:half` | ✗ |
478
-
479
- <sup>\*</sup> ***`magick:format` requires an ext or a valid MIME content type like `image/jpeg` or `.jpg`. We will `ImageMagick -format` on your behalf with that information by getting the extension.***
456
+ | Name | Accepts Value |
457
+ | --------------------------- | ------------- |
458
+ | `magick:compress` | ✔ |
459
+ | `magick:resize` | ✔ |
460
+ | `magick:format`<sup>*</sup> | ✔ |
461
+ | `magick:quality` | ✔ |
462
+ | `magick:rotate` | ✔ |
463
+ | `magick:gravity` | ✔ |
464
+ | `magick:crop` | ✔ |
465
+ | `magick:flip` | ✔ |
466
+ | `@magick:double` | ✗ |
467
+ | `@magick:half` | ✗ |
468
+
469
+ <sup>\*</sup> *`magick:format` requires an ext or a valid MIME content type like `image/jpeg` or `.jpg`. We will `ImageMagick -format` on your behalf with that information by getting the extension.*
480
470
 
481
471
  ### ImageOptim
482
- #### Installation
483
472
 
484
473
  ```ruby
485
474
  gem "image_optim"
486
475
  ```
487
476
 
488
- #### Config
489
-
490
- Check the [ImageOptim](https://github.com/toy/image_optim#configuration) to get idea about configuration options.
477
+ Check the [ImageOptim](https://github.com/toy/image_optim#configuration) to get idea about configuration options.
491
478
 
492
479
  ```yml
493
480
  assets:
@@ -505,27 +492,27 @@ assets:
505
492
  strategy: 4
506
493
  ```
507
494
 
508
- #### Tag Args
495
+ #### Args
509
496
 
510
- | Name | Accepts Value |
511
- |---|---|
512
- | `@image_optim:preset`<sup>*</sup> | ✗ |
497
+ | Name | Accepts Value |
498
+ | --------------------------------- | ------------- |
499
+ | `@image_optim:preset`<sup>*</sup> | ✗ |
513
500
 
514
501
  <sup>\*</sup>***Where `preset` is the name of the preset.***
515
502
 
516
503
  ### Building Your Own Plugins
517
- #### Global Instance Vars
504
+ #### Globals
518
505
 
519
- | Name | Class |
520
- |---|---|
521
- | `@env` | `Jekyll::Assets::Env` |
522
- | `@args` | `Liquid::Tag::Parser{}` |
523
- | `@jekyll` | `Jekyll::Site` |
524
- | `@asset` | `Sprockets::Asset` |
506
+ | Name | Class |
507
+ | --------- | ----------------------- |
508
+ | `@env` | `Jekyll::Assets::Env` |
509
+ | `@args` | `Liquid::Tag::Parser{}` |
510
+ | `@jekyll` | `Jekyll::Site` |
511
+ | `@asset` | `Sprockets::Asset` |
525
512
 
526
- ##### HTML Instance Vars
513
+ #### HTML
527
514
 
528
- | Name | Class | Type |
529
- |---|---|---|
515
+ | Name | Class | Type |
516
+ | ------ | -------------------------- | --------------- |
530
517
  | `@doc` | `Nokogiri:: XML::Document` | `image/svg+xml` |
531
- | `@doc` | `Nokogiri::HTML::Document` | `image/*` |
518
+ | `@doc` | `Nokogiri::HTML::Document` | `image/*` |