jekyll-assets 2.1.3 → 2.2.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.
- checksums.yaml +4 -4
- data/Gemfile +6 -2
- data/LICENSE +2 -2
- data/README.md +38 -31
- data/Rakefile +1 -40
- data/lib/jekyll-assets.rb +3 -1
- data/lib/jekyll/assets.rb +18 -16
- data/lib/jekyll/assets/addons.rb +3 -9
- data/lib/jekyll/assets/addons/autoprefixer.rb +6 -2
- data/lib/jekyll/assets/addons/bootstrap.rb +3 -1
- data/lib/jekyll/assets/addons/fontawesome.rb +7 -0
- data/lib/jekyll/assets/addons/{js_es6.rb → javascript.rb} +3 -1
- data/lib/jekyll/assets/addons/less.rb +9 -0
- data/lib/jekyll/assets/cached.rb +13 -2
- data/lib/jekyll/assets/config.rb +24 -14
- data/lib/jekyll/assets/env.rb +92 -40
- data/lib/jekyll/assets/hook.rb +14 -4
- data/lib/jekyll/assets/hooks.rb +5 -5
- data/lib/jekyll/assets/hooks/cache.rb +11 -3
- data/lib/jekyll/assets/hooks/compression.rb +12 -2
- data/lib/jekyll/assets/hooks/{configuration.rb → config.rb} +3 -1
- data/lib/jekyll/assets/hooks/erb.rb +15 -0
- data/lib/jekyll/assets/hooks/helpers.rb +4 -3
- data/lib/jekyll/assets/hooks/jekyll/drops.rb +3 -1
- data/lib/jekyll/assets/hooks/jekyll/setup.rb +6 -8
- data/lib/jekyll/assets/hooks/jekyll/write.rb +6 -2
- data/lib/jekyll/assets/hooks/logger.rb +6 -2
- data/lib/jekyll/assets/hooks/sources.rb +4 -1
- data/lib/jekyll/assets/hooks/sprockets.rb +3 -1
- data/lib/jekyll/assets/hooks/version.rb +6 -2
- data/lib/jekyll/assets/liquid.rb +3 -1
- data/lib/jekyll/assets/liquid/drop.rb +20 -2
- data/lib/jekyll/assets/liquid/filters.rb +13 -14
- data/lib/jekyll/assets/liquid/tag.rb +101 -39
- data/lib/jekyll/assets/liquid/tag/defaults.rb +2 -0
- data/lib/jekyll/assets/liquid/tag/defaults/image.rb +25 -5
- data/lib/jekyll/assets/liquid/tag/parser.rb +27 -19
- data/lib/jekyll/assets/liquid/tag/proxied_asset.rb +33 -20
- data/lib/jekyll/assets/liquid/tag/proxies.rb +21 -16
- data/lib/jekyll/assets/logger.rb +29 -15
- data/lib/jekyll/assets/manifest.rb +98 -0
- data/lib/jekyll/assets/patches.rb +4 -2
- data/lib/jekyll/assets/patches/jekyll/site.rb +0 -4
- data/lib/jekyll/assets/patches/kernel.rb +4 -14
- data/lib/jekyll/assets/patches/sprockets/asset.rb +10 -4
- data/lib/jekyll/assets/patches/sprockets/helpers.rb +31 -0
- data/lib/jekyll/assets/processors.rb +1 -0
- data/lib/jekyll/assets/processors/less.rb +68 -0
- data/lib/jekyll/assets/processors/liquid.rb +46 -0
- data/lib/jekyll/assets/proxies.rb +1 -0
- data/lib/jekyll/assets/proxies/magick.rb +167 -0
- data/lib/jekyll/assets/version.rb +4 -2
- metadata +52 -23
- data/lib/jekyll/assets/addons/compass.rb +0 -11
- data/lib/jekyll/assets/addons/font_awesome.rb +0 -5
- data/lib/jekyll/assets/addons/processors/liquid.rb +0 -31
- data/lib/jekyll/assets/addons/proxies/magick.rb +0 -126
- data/lib/jekyll/assets/hooks/context_patches.rb +0 -17
- data/lib/jekyll/assets/hooks/disable_erb.rb +0 -10
- data/lib/jekyll/assets/patches/jekyll/cleaner.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6232e0cf35a9ec33f5b9ac89ae3b851d5a011746
|
4
|
+
data.tar.gz: 9e40e80f28270152944ee1280fe19d0091718df4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b4ab0c20304eaf4675be53a0ef3971e279bc89da76131fd60a428cc9ba8df17970e94e0f65bd9c0954bb3f29d5179ecab87372e69dddf837cd3f054b5f757fb
|
7
|
+
data.tar.gz: 009df087377720ca2f8cb321bfadaca59051bd0543a323c2b0dcc1d62c807d84992680ba9caa0e35d660731577ed3f7b08482c91dee1dcc390c013912302336e
|
data/Gemfile
CHANGED
@@ -4,17 +4,21 @@ gemspec
|
|
4
4
|
gem "rake"
|
5
5
|
group :development do
|
6
6
|
gem "therubyracer", :platforms => :mri, :require => false
|
7
|
+
gem "therubyrhino", :platforms => :jruby, :require => false
|
8
|
+
gem "stackprof", :platforms => :mri, :require => false
|
7
9
|
gem "pry", :require => false
|
8
10
|
end
|
9
11
|
|
10
12
|
group :test do
|
11
13
|
gem "codeclimate-test-reporter", :require => false
|
14
|
+
gem "rubocop", :github => "bbatsov/rubocop", :branch => :master, :require => false
|
15
|
+
gem "luna-rubocop-formatters", :require => false
|
12
16
|
end
|
13
17
|
|
14
18
|
gem "uglifier", :require => false
|
15
19
|
gem "sprockets-es6", "~> 0.6", :require => false
|
16
20
|
gem "autoprefixer-rails", "~> 6.0", :require => false
|
17
|
-
gem "font-awesome-sass", "~> 4.4
|
21
|
+
gem "font-awesome-sass", "~> 4.4", :require => false
|
18
22
|
gem "bootstrap-sass", "~> 3.3", :require => false
|
19
23
|
gem "mini_magick", "~> 4.2", :require => false
|
20
|
-
gem "
|
24
|
+
gem "less", "~> 2.6.0", :require => false
|
data/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Copyright (c) 2012-
|
2
|
-
Copyright (c) 2015 Jordon Bedwell (https://envygeeks.io)
|
1
|
+
Copyright (c) 2012 - 2015 Aleksey V Zapparov (http://ixti.net/)
|
2
|
+
Copyright (c) 2015 - 2016 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,6 +1,6 @@
|
|
1
|
-
[][coverage]
|
3
|
-
[][code-climate] [][gemnasium]
|
1
|
+
[][travis]
|
2
|
+
[][coverage]
|
3
|
+
[][code-climate] [][gemnasium]
|
4
4
|
|
5
5
|
[gemnasium]: https://gemnasium.com/jekyll/jekyll-assets
|
6
6
|
[code-climate]: https://codeclimate.com/github/jekyll/jekyll-assets
|
@@ -10,16 +10,13 @@
|
|
10
10
|
# Jekyll 3 Assets
|
11
11
|
|
12
12
|
Jekyll 3 assets is an asset pipeline using Sprockets 3 to build especially
|
13
|
-
for Jekyll 3.
|
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
16
|
## Using Jekyll Assets with Jekyll
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
when you bundle install and run Jekyll through bundle exec. However, when you
|
21
|
-
have globally installed Gems (`gem install jekyll-assets`) then in your
|
22
|
-
`_config.yml` do:
|
18
|
+
Add `gem "jekyll-assets"` to your `Gemfile` and add `jekyll-assets`
|
19
|
+
to your `_config.yml` like the following:
|
23
20
|
|
24
21
|
```yaml
|
25
22
|
gems:
|
@@ -29,8 +26,8 @@ gems:
|
|
29
26
|
## Configuration
|
30
27
|
|
31
28
|
A lot of our configuration transforms based on the `JEKYLL_ENV` variable
|
32
|
-
set in your environment.
|
33
|
-
CDN.
|
29
|
+
set in your environment. Such as digesting and whether or not to enable the
|
30
|
+
CDN. Some of them can be explicitly overridden but a few cannot right now.
|
34
31
|
You should set your `JEKYLL_ENV=development` on your development
|
35
32
|
machine and `JEKYLL_ENV=production` when building to push.
|
36
33
|
|
@@ -38,12 +35,13 @@ machine and `JEKYLL_ENV=production` when building to push.
|
|
38
35
|
assets:
|
39
36
|
compress:
|
40
37
|
css: false | true | default - development: false, production: true
|
41
|
-
|
38
|
+
js: false | true | default - development: false, production: true
|
42
39
|
cache: false | directory | default: .asset-cache
|
43
40
|
cdn: https://cdn.example.com
|
44
41
|
skip_baseurl_with_cdn: false
|
45
|
-
|
42
|
+
skip_prefix_with_cdn: false
|
46
43
|
prefix: "/assets"
|
44
|
+
autowrite: true
|
47
45
|
assets:
|
48
46
|
- "*.png"
|
49
47
|
- "bundle.css"
|
@@ -57,10 +55,22 @@ assets:
|
|
57
55
|
- _assets/img
|
58
56
|
- _assets/js
|
59
57
|
features:
|
60
|
-
|
58
|
+
liquid: true | false | default: false
|
59
|
+
automatic_img_size: true | false | n(fixnum): 2,4,6,8 | default: true
|
61
60
|
automatic_img_alt : true | false | default: true
|
62
61
|
```
|
63
62
|
|
63
|
+
### Liquid Processing with your Jekyll context
|
64
|
+
|
65
|
+
By default (whether `features.liquid` is true or false) we will process
|
66
|
+
all files with the extension ".liquid", so if you give us ".scss.liquid"
|
67
|
+
we will parse the liquid and then we will parse the SCSS and finally
|
68
|
+
output your ".css" file.
|
69
|
+
|
70
|
+
When `features.liquid` is set to true, we will process ***ALL*** files
|
71
|
+
through Liquid, regardless of whether they have the ".liquid" extension.
|
72
|
+
Use this at your own risk.
|
73
|
+
|
64
74
|
### Cache Folder
|
65
75
|
|
66
76
|
If you plan to change the `cache` folder, please make sure to add that
|
@@ -70,8 +80,8 @@ and over again, `.` folders are not ignored by default.
|
|
70
80
|
### Sources
|
71
81
|
|
72
82
|
The listed resources in the example are all defaults. It should be noted
|
73
|
-
that we append your sources instead of replace our resources with yours.
|
74
|
-
if you add
|
83
|
+
that we append your sources instead of replace our resources with yours. So
|
84
|
+
if you add `_assets/folder` then we will append that to our sources and
|
75
85
|
both will work.
|
76
86
|
|
77
87
|
***NOTE: if you use our `_assets` base folder container as a base folder for
|
@@ -81,33 +91,32 @@ folder as the sole source (base folder.)***
|
|
81
91
|
### Digesting
|
82
92
|
|
83
93
|
* Disable digesting by default in development.
|
84
|
-
* Digest by default in production
|
94
|
+
* Digest by default in production.
|
85
95
|
|
86
96
|
***You can force digesting with `digest: true` in your `_config.yml`***
|
87
97
|
|
88
98
|
### Compression
|
89
99
|
|
90
|
-
* Requires sass and
|
100
|
+
* Requires sass and uglifier.
|
91
101
|
* Disable compression by default in development.
|
92
102
|
* Enable by default in production.
|
93
103
|
|
94
|
-
|
95
104
|
### Bower Components
|
96
105
|
|
97
106
|
Modify your `.bowerrc` file and add:
|
98
107
|
|
99
|
-
```
|
108
|
+
```json
|
100
109
|
{
|
101
110
|
"directory": "_assets/bower"
|
102
111
|
}
|
103
112
|
```
|
104
113
|
|
105
114
|
And then add `_assets/bower` to your sources list and Sprockets will do the
|
106
|
-
the rest for you... you can even `//= require bower_asset.js`.
|
115
|
+
the rest for you... you can even `//= require bower_asset.js`. We will even
|
107
116
|
compress them for you per normal if Sprockets supports it and allows us to.
|
108
117
|
|
109
118
|
***You do not need to modify your `.bowerrc` file, you can optionally just
|
110
|
-
add it to your sources list and it will work that way too!
|
119
|
+
add it to your sources list and it will work that way too! As long as it's in
|
111
120
|
your Jekyll folder.***
|
112
121
|
|
113
122
|
## Tags
|
@@ -137,7 +146,7 @@ your Jekyll folder.***
|
|
137
146
|
Lets say we have `sprockets` proxies and sprockets allows you to proxy accept,
|
138
147
|
if you send `{% img src sprockets:accept:image/gif }` then Sprockets find_asset
|
139
148
|
will get `{ :accept => "image/gif" }` but if you try to proxy "unknown" on
|
140
|
-
sprockets we will raise a Proxy error.
|
149
|
+
sprockets we will raise a Proxy error. For more information then look at
|
141
150
|
`parser_spec.rb` in the spec folder because it literally lays out the ground
|
142
151
|
rules for our tags as a specification.
|
143
152
|
|
@@ -230,18 +239,21 @@ end
|
|
230
239
|
|
231
240
|
***Our currently supported helpers are:***
|
232
241
|
|
242
|
+
* asset_url
|
233
243
|
* asset_path
|
234
244
|
* image_path
|
235
245
|
* font_path
|
246
|
+
* image_url
|
247
|
+
* font_url
|
236
248
|
|
237
249
|
## Addons
|
238
250
|
|
239
251
|
* CSS Auto Prefixer - add "autoprefixer-rails" to your Gemfile.
|
240
252
|
* ES6 Transpiler (through Babel) - add "sprockets-es6" to your Gemfile.
|
241
|
-
* Image Magick - add "mini_magick"
|
253
|
+
* Image Magick - add "mini_magick" to your Gemfile, only works with `img`, `image`.
|
242
254
|
* Bootstrap - add "bootstrap-sass" to your Gemfile and "@import 'bootstrap'"
|
243
|
-
* Compass - add "compass-core" to your Gemfile and "@import 'compass'"
|
244
255
|
* Font Awesome - add "font-awesome-sass" to your Gemfile.
|
256
|
+
* LESS - add "less" to your Gemfile
|
245
257
|
|
246
258
|
***Please note that some of these (if not all) have trouble with Rhino --
|
247
259
|
`therubyrhino` so you would probably be best to just use Node.js or io.js at
|
@@ -253,6 +265,7 @@ that point rather than trying to fight it.***
|
|
253
265
|
* `magick:format:<value>`
|
254
266
|
* `magick:quality:<value>`
|
255
267
|
* `magick:rotate:<value>`
|
268
|
+
* `magick:gravity:<value>`
|
256
269
|
* `magick:crop:<value>`
|
257
270
|
* `magick:flip:<value>`
|
258
271
|
* `magick:quadruple`, `magick:4x`
|
@@ -263,12 +276,6 @@ that point rather than trying to fight it.***
|
|
263
276
|
* `magick:one-fourth`, `magick:1/4`
|
264
277
|
* `magick:half`, `magick:1/2`
|
265
278
|
|
266
|
-
## Plugins where did they go?
|
267
|
-
|
268
|
-
They're dead, in the way that they were, use Hooks, they require less
|
269
|
-
patching and give more flexibility to us because we can trigger them every
|
270
|
-
time we have a new environment not just occasionally.
|
271
|
-
|
272
279
|
## Having trouble with our documentation?
|
273
280
|
|
274
281
|
If you do not understand something in our documentation please feel
|
data/Rakefile
CHANGED
@@ -1,43 +1,4 @@
|
|
1
|
+
require "luna/rubocop/rake/task"
|
1
2
|
require "rspec/core/rake_task"
|
2
3
|
RSpec::Core::RakeTask.new(:spec)
|
3
4
|
task :default => [:spec]
|
4
|
-
|
5
|
-
task :analysis do
|
6
|
-
require "open3"
|
7
|
-
begin require "jekyll/utils/ansi"
|
8
|
-
rescue LoadError
|
9
|
-
require_relative "spec/support/ansi"
|
10
|
-
end
|
11
|
-
|
12
|
-
cmd = [
|
13
|
-
"docker", "run", "--rm", "--env=CODE_PATH=#{Dir.pwd}", \
|
14
|
-
"--volume='#{Dir.pwd}:/code'", "--volume=/var/run/docker.sock:/var/run/docker.sock", \
|
15
|
-
"--volume=/tmp/cc:/tmp/cc", "-i", "codeclimate/codeclimate", "analyze"
|
16
|
-
]
|
17
|
-
|
18
|
-
ansi = Jekyll::Utils::Ansi
|
19
|
-
file = File.open(".analysis", "w+")
|
20
|
-
Open3.popen3(cmd.shelljoin) do |_, out, err, _|
|
21
|
-
while data = out.gets
|
22
|
-
file.write data
|
23
|
-
if data =~ /\A==/
|
24
|
-
$stdout.print ansi.yellow(data)
|
25
|
-
|
26
|
-
elsif data !~ %r!\A[0-9\-]+!
|
27
|
-
$stdout.puts data
|
28
|
-
|
29
|
-
else
|
30
|
-
h, d = data.split(":", 2)
|
31
|
-
$stdout.print ansi.cyan(h)
|
32
|
-
$stdout.print ":", d
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
while data = err.gets
|
37
|
-
file.write data
|
38
|
-
$stderr.print ansi.red(data)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
file.close
|
43
|
-
end
|
data/lib/jekyll-assets.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
1
2
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
3
4
|
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
4
6
|
|
5
7
|
require "jekyll/assets"
|
data/lib/jekyll/assets.rb
CHANGED
@@ -1,22 +1,24 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
1
2
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
3
4
|
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
4
6
|
|
5
|
-
require "tilt"
|
6
7
|
require "sprockets"
|
8
|
+
require "extras/all"
|
9
|
+
require "pathutil"
|
7
10
|
require "jekyll"
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
12
|
+
require_relative "assets/env"
|
13
|
+
require_relative "assets/version"
|
14
|
+
require_relative "assets/patches"
|
15
|
+
require_relative "assets/config"
|
16
|
+
require_relative "assets/cached"
|
17
|
+
require_relative "assets/hook"
|
18
|
+
require_relative "assets/logger"
|
19
|
+
require_relative "assets/hooks"
|
20
|
+
require_relative "assets/liquid"
|
21
|
+
require_relative "assets/addons"
|
22
|
+
require_relative "assets/processors"
|
23
|
+
require_relative "assets/manifest"
|
24
|
+
require_relative "assets/proxies"
|
data/lib/jekyll/assets/addons.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
# Copyright: 2012-2015 - MIT License
|
3
|
-
# Encoding: utf-8
|
4
|
-
|
5
|
-
require_relative "addons/compass"
|
1
|
+
require_relative "addons/less"
|
6
2
|
require_relative "addons/bootstrap"
|
7
3
|
require_relative "addons/autoprefixer"
|
8
|
-
require_relative "addons/
|
9
|
-
require_relative "addons/
|
10
|
-
require_relative "addons/font_awesome"
|
11
|
-
require_relative "addons/js_es6"
|
4
|
+
require_relative "addons/fontawesome"
|
5
|
+
require_relative "addons/javascript"
|
@@ -1,9 +1,13 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
1
2
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
3
4
|
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
4
6
|
|
5
7
|
try_require_if_javascript "autoprefixer-rails" do
|
6
8
|
Jekyll::Assets::Hook.register :env, :init do |env|
|
7
|
-
AutoprefixerRails.install(env
|
9
|
+
AutoprefixerRails.install(env, env.asset_config[
|
10
|
+
"autoprefixer"
|
11
|
+
])
|
8
12
|
end
|
9
13
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
1
2
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
3
4
|
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
4
6
|
|
5
7
|
try_require "bootstrap-sass"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# Frozen-string-literal: true
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
4
|
+
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
6
|
+
|
7
|
+
try_require "font-awesome-sass"
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
1
2
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
3
4
|
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
4
6
|
|
5
7
|
try_require_if_javascript "sprockets/es6" do
|
6
8
|
if ExecJS.runtime.is_a?(ExecJS::RubyRhinoRuntime)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# Frozen-string-literal: true
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
4
|
+
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
6
|
+
|
7
|
+
try_require_if_javascript(
|
8
|
+
"jekyll/assets/processors/less"
|
9
|
+
)
|
data/lib/jekyll/assets/cached.rb
CHANGED
@@ -1,16 +1,27 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
1
2
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
3
4
|
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
4
6
|
|
5
7
|
module Jekyll
|
6
8
|
module Assets
|
7
9
|
class Cached < Sprockets::CachedEnvironment
|
8
|
-
attr_reader :jekyll
|
10
|
+
attr_reader :jekyll
|
11
|
+
attr_reader :parent
|
12
|
+
|
13
|
+
# ----------------------------------------------------------------------
|
14
|
+
|
9
15
|
def initialize(env)
|
10
16
|
@parent = env
|
11
17
|
@jekyll = env.jekyll
|
18
|
+
@resolve_cache = {}
|
12
19
|
super env
|
13
20
|
end
|
21
|
+
|
22
|
+
def resolve(*args)
|
23
|
+
@resolve_cache[args] ||= super
|
24
|
+
end
|
14
25
|
end
|
15
26
|
end
|
16
27
|
end
|
data/lib/jekyll/assets/config.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
1
2
|
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-
|
3
|
+
# Copyright: 2012 - 2016 - MIT License
|
3
4
|
# Encoding: utf-8
|
5
|
+
# ----------------------------------------------------------------------------
|
4
6
|
|
5
7
|
module Jekyll
|
6
8
|
module Assets
|
@@ -11,12 +13,15 @@ module Jekyll
|
|
11
13
|
_assets/javascripts _assets/js
|
12
14
|
).freeze
|
13
15
|
|
16
|
+
# ----------------------------------------------------------------------
|
17
|
+
|
14
18
|
Development = {
|
15
19
|
"skip_baseurl_with_cdn" => false,
|
16
20
|
"skip_prefix_with_cdn" => false,
|
17
21
|
"prefix" => "/assets",
|
18
22
|
"digest" => false,
|
19
23
|
"assets" => [],
|
24
|
+
"autowrite" => true,
|
20
25
|
|
21
26
|
"compress" => {
|
22
27
|
"css" => false,
|
@@ -25,11 +30,12 @@ module Jekyll
|
|
25
30
|
|
26
31
|
"features" => {
|
27
32
|
"automatic_img_alt" => true,
|
28
|
-
"automatic_img_size" => true
|
33
|
+
"automatic_img_size" => true,
|
34
|
+
"liquid" => false
|
29
35
|
}
|
30
36
|
}.freeze
|
31
37
|
|
32
|
-
#
|
38
|
+
# ----------------------------------------------------------------------
|
33
39
|
|
34
40
|
Production = Development.merge({
|
35
41
|
"digest" => true,
|
@@ -39,25 +45,29 @@ module Jekyll
|
|
39
45
|
}
|
40
46
|
}).freeze
|
41
47
|
|
42
|
-
#
|
48
|
+
# ----------------------------------------------------------------------
|
43
49
|
|
44
|
-
def self.merge_sources(jekyll, config)
|
45
|
-
config["sources"]
|
46
|
-
|
47
|
-
sources = DefaultSources + config["sources"].to_a
|
50
|
+
def self.merge_sources(jekyll, config) config["sources"] ||= []
|
51
|
+
if !config["sources"].grep(/\A\s*_assets\/?\s*\Z/).empty?
|
52
|
+
return
|
48
53
|
|
49
|
-
|
50
|
-
|
51
|
-
|
54
|
+
else
|
55
|
+
sources = DefaultSources + config["sources"].to_a
|
56
|
+
config["sources"] = Set.new(sources.map do |val|
|
57
|
+
jekyll.in_source_dir(val)
|
58
|
+
end)
|
59
|
+
end
|
52
60
|
end
|
53
61
|
|
54
|
-
#
|
62
|
+
# ----------------------------------------------------------------------
|
55
63
|
|
56
64
|
def self.defaults
|
57
|
-
%W(development test).include?(Jekyll.env)
|
65
|
+
if %W(development test).include?(Jekyll.env)
|
66
|
+
then Development else Production
|
67
|
+
end
|
58
68
|
end
|
59
69
|
|
60
|
-
#
|
70
|
+
# ----------------------------------------------------------------------
|
61
71
|
|
62
72
|
def self.merge(new_hash, old_hash = defaults)
|
63
73
|
old_hash.merge(new_hash) do |_, old_val, new_val|
|