jekyll-assets 2.0.1 → 2.0.2
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aea26a562f8bf6434a8abef51619c84fea8c2fa3
|
4
|
+
data.tar.gz: a67c580d10fa19e002fd0dac3dec76c314c67d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2c7db920e0a4ad9fe9b452d3e4c56e9aed74b0550046785ec3261730b3e8b304161ff469d55924651105cdfd33d27ac59d2f9998050730d87a1c0b3fe98369
|
7
|
+
data.tar.gz: 3f7108135a09f18d5f63cbb4ea8038301fb3fa2919f1a8e790a1a2f14adf6ef75f24f9f06be43d6f070049d4fd801739b625dade9d0b75ce7bb867e429e16ec3
|
data/README.md
CHANGED
@@ -13,10 +13,6 @@ Jekyll 3 assets is an asset pipeline using Sprockets 3 to build especially
|
|
13
13
|
for Jekyll 3. It utilizes new features of both Sprockets and Jekyll to achieve
|
14
14
|
a clean and extensible assets platform for Jekyll.
|
15
15
|
|
16
|
-
## Having trouble with our documentation?
|
17
|
-
|
18
|
-
If you do not understand something in our documentation please feel free to file a ticket and it will be explained and the documentation updated, however... if you have already figured out the problem please feel free to submit a pull request with clarification in the documentation and we'll happily work with you on updating it.
|
19
|
-
|
20
16
|
## Using Jekyll Assets with Jekyll
|
21
17
|
|
22
18
|
When you are using a Gemfile and bundler you need to do nothing special to get
|
@@ -32,7 +28,11 @@ gems:
|
|
32
28
|
|
33
29
|
## Configuration
|
34
30
|
|
35
|
-
A lot of our configuration transforms based on the `JEKYLL_ENV` variable
|
31
|
+
A lot of our configuration transforms based on the `JEKYLL_ENV` variable
|
32
|
+
set in your environment. Such as digesting and whether or not to enable the
|
33
|
+
CDN. Some of them can be explicitly overridden but a few cannot right now.
|
34
|
+
You should set your `JEKYLL_ENV=development` on your development
|
35
|
+
machine and `JEKYLL_ENV=production` when building to push.
|
36
36
|
|
37
37
|
```yaml
|
38
38
|
assets:
|
@@ -56,11 +56,21 @@ assets:
|
|
56
56
|
- _assets/fonts
|
57
57
|
- _assets/img
|
58
58
|
- _assets/js
|
59
|
+
features:
|
60
|
+
automatic_image_size: true | false | default: true
|
61
|
+
automatic_image_alt : true | false | default: true
|
59
62
|
```
|
60
63
|
|
61
64
|
### Sources
|
62
65
|
|
63
|
-
The listed resources in the example are all defaults. It should be noted
|
66
|
+
The listed resources in the example are all defaults. It should be noted
|
67
|
+
that we append your sources instead of replace our resources with yours. So
|
68
|
+
if you add "_assets/folder" then we will append that to our sources and
|
69
|
+
both will work.
|
70
|
+
|
71
|
+
***NOTE: if you use our `_assets` base folder container as a base folder for
|
72
|
+
your sprockets, we will not append our sources, we will only use that
|
73
|
+
folder as the sole source (base folder.)***
|
64
74
|
|
65
75
|
### Digesting
|
66
76
|
|
@@ -232,3 +242,11 @@ that point rather than trying to fight it.***
|
|
232
242
|
They're dead, in the way that they were, use Hooks, they require less
|
233
243
|
patching and give more flexibility to us because we can trigger them every
|
234
244
|
time we have a new environment not just occasionally.
|
245
|
+
|
246
|
+
## Having trouble with our documentation?
|
247
|
+
|
248
|
+
If you do not understand something in our documentation please feel
|
249
|
+
free to file a ticket and it will be explained and the documentation updated,
|
250
|
+
however... if you have already figured out the problem please feel free to
|
251
|
+
submit a pull request with clarification in the documentation and we'll
|
252
|
+
happily work with you on updating it.
|
data/lib/jekyll/assets/config.rb
CHANGED
@@ -21,6 +21,11 @@ module Jekyll
|
|
21
21
|
"compress" => {
|
22
22
|
"css" => false,
|
23
23
|
"js" => false
|
24
|
+
},
|
25
|
+
|
26
|
+
"features" => {
|
27
|
+
"automatic_img_alt" => true,
|
28
|
+
"automatic_img_size" => true
|
24
29
|
}
|
25
30
|
}
|
26
31
|
|
@@ -37,6 +42,7 @@ module Jekyll
|
|
37
42
|
#
|
38
43
|
|
39
44
|
def self.merge_sources(jekyll, config)
|
45
|
+
return if config["sources"] && config["sources"].grep(/\A\s*_assets\/?\s*\Z/).size > 0
|
40
46
|
config["sources"] = (DefaultSources + (config["sources"] ||= [])).map do |val|
|
41
47
|
jekyll.in_source_dir(val)
|
42
48
|
end
|
@@ -100,7 +100,7 @@ module Jekyll
|
|
100
100
|
private
|
101
101
|
def process_tag(args, sprockets, asset)
|
102
102
|
sprockets.used.add(asset) unless @tag == "asset_source"
|
103
|
-
Defaults.set_defaults_for!(@tag, args ||= {}, asset)
|
103
|
+
Defaults.set_defaults_for!(@tag, args ||= {}, asset, sprockets)
|
104
104
|
build_html(args, sprockets, asset)
|
105
105
|
end
|
106
106
|
|
@@ -5,10 +5,13 @@ module Jekyll
|
|
5
5
|
module Defaults
|
6
6
|
require_relative "defaults/image"
|
7
7
|
|
8
|
+
# TODO: In 3.0 env needs to be enforced, right now it's not
|
9
|
+
# because it's maintain 2.0 API.
|
10
|
+
|
8
11
|
module_function
|
9
|
-
def set_defaults_for!(tag, args, asset)
|
12
|
+
def set_defaults_for!(tag, args, asset, env = nil)
|
10
13
|
constants.select { |const| const_get(const).is_for?(tag) }.each do |const|
|
11
|
-
const_get(const).new(args, asset).set!
|
14
|
+
const_get(const).new(args, asset, env).set!
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# Frozen-string-literal: true
|
2
|
+
# Copyright: 2012-2015 - MIT License
|
3
|
+
# Encoding: utf-8
|
4
|
+
|
1
5
|
module Jekyll
|
2
6
|
module Assets
|
3
7
|
module Liquid
|
@@ -8,10 +12,12 @@ module Jekyll
|
|
8
12
|
tag == "img" || tag == "image"
|
9
13
|
end
|
10
14
|
|
11
|
-
#
|
15
|
+
# TODO: In 3.0 env needs to be enforced if this is not changed,
|
16
|
+
# for now it's not enforced to maintain the 2.0 API.
|
12
17
|
|
13
|
-
def initialize(args, asset)
|
18
|
+
def initialize(args, asset, env = nil)
|
14
19
|
@asset = asset
|
20
|
+
@env = env
|
15
21
|
@args = args
|
16
22
|
end
|
17
23
|
|
@@ -22,26 +28,30 @@ module Jekyll
|
|
22
28
|
set_img_alt
|
23
29
|
end
|
24
30
|
|
25
|
-
#
|
31
|
+
# TODO: 3.0 - Remove the `!@env`
|
26
32
|
|
27
33
|
private
|
28
34
|
def set_img_alt
|
29
|
-
@
|
30
|
-
|
31
|
-
|
35
|
+
if !@env || @env.asset_config["features"]["automatic_img_alt"]
|
36
|
+
@args[:html] ||= {}
|
37
|
+
if !@args[:html].has_key?("alt")
|
38
|
+
then @args[:html]["alt"] = @asset.logical_path
|
39
|
+
end
|
32
40
|
end
|
33
41
|
end
|
34
42
|
|
35
|
-
#
|
43
|
+
# TODO: 3.0 - Remove the `!@env`
|
36
44
|
|
37
45
|
private
|
38
46
|
def set_img_dimensions
|
39
|
-
|
40
|
-
|
41
|
-
|
47
|
+
if !@env || @env.asset_config["features"]["automatic_img_size"]
|
48
|
+
dimensions = FastImage.new(@asset.filename).size
|
49
|
+
return unless dimensions
|
50
|
+
@args[:html] ||= {}
|
42
51
|
|
43
|
-
|
44
|
-
|
52
|
+
@args[:html][ "width"] ||= dimensions.first
|
53
|
+
@args[:html]["height"] ||= dimensions. last
|
54
|
+
end
|
45
55
|
end
|
46
56
|
end
|
47
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordon Bedwell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-11-
|
13
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sprockets
|