jekyll-minibundle 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -6
- data/README.md +34 -24
- data/Rakefile +19 -14
- data/jekyll-minibundle.gemspec +5 -4
- data/lib/jekyll/minibundle/asset_bundle.rb +24 -4
- data/lib/jekyll/minibundle/asset_file_operations.rb +0 -8
- data/lib/jekyll/minibundle/asset_file_properties.rb +26 -8
- data/lib/jekyll/minibundle/asset_file_registry.rb +57 -21
- data/lib/jekyll/minibundle/asset_tag_markup.rb +13 -4
- data/lib/jekyll/minibundle/bundle_file.rb +9 -6
- data/lib/jekyll/minibundle/compatibility.rb +11 -1
- data/lib/jekyll/minibundle/development_file.rb +6 -0
- data/lib/jekyll/minibundle/development_file_collection.rb +3 -16
- data/lib/jekyll/minibundle/environment.rb +5 -12
- data/lib/jekyll/minibundle/files.rb +18 -0
- data/lib/jekyll/minibundle/hashes.rb +20 -0
- data/lib/jekyll/minibundle/mini_bundle_block.rb +52 -12
- data/lib/jekyll/minibundle/mini_stamp_tag.rb +27 -8
- data/lib/jekyll/minibundle/stamp_file.rb +9 -6
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/fixture/site/_bin/with_count +6 -5
- data/test/integration/known_caveats_test.rb +89 -0
- data/test/integration/minibundle_development_mode_test.rb +171 -26
- data/test/integration/minibundle_production_mode_test.rb +234 -42
- data/test/integration/ministamp_development_mode_test.rb +145 -0
- data/test/integration/{ministamp_test.rb → ministamp_production_mode_test.rb} +72 -23
- data/test/integration/static_files_as_asset_sources_test.rb +3 -0
- data/test/support/assertions.rb +24 -0
- data/test/support/fixture_config.rb +13 -10
- data/test/support/static_file_api_config.rb +9 -3
- data/test/support/test_case.rb +7 -6
- data/test/unit/asset_bundle_test.rb +16 -2
- data/test/unit/asset_file_registry_test.rb +117 -14
- data/test/unit/asset_tag_markup_test.rb +17 -5
- data/test/unit/bundle_file_properties_test.rb +32 -8
- data/test/unit/bundle_file_writing_test.rb +10 -11
- data/test/unit/development_file_collection_properties_test.rb +47 -15
- data/test/unit/environment_test.rb +0 -13
- data/test/unit/files_test.rb +46 -0
- data/test/unit/hashes_test.rb +41 -0
- data/test/unit/mini_bundle_block_test.rb +56 -1
- data/test/unit/mini_stamp_tag_test.rb +8 -8
- data/test/unit/stamp_file_properties_test.rb +32 -13
- data/test/unit/stamp_file_writing_test.rb +1 -5
- metadata +38 -16
- data/test/unit/development_file_collection_writing_test.rb +0 -43
- data/test/unit/jekyll_payload_test.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7dc5bf67a5d4a713810a998484b2bca9ecc1cc3
|
4
|
+
data.tar.gz: 4f2fc0b94c6e29a573666627609e50dccdc123ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7571e9ec0a7a0c7914afbaf93b3442747b50b36b5645ac67d6745ecb777a49d17c66c40f6d7af2fc87e265fcf888b53d17a9dd3f9c80c390e2b048b458d8dc3
|
7
|
+
data.tar.gz: 0bfeacb9e08ea16d1e4815af0b3dfa7c061ffd7138fa883a2619817b9588d30fefe3b72c0b843db84282e2c9c429714e138f65239e579326636c1a715c21ab35
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 1.6.0 / 2016-03-26
|
2
|
+
|
3
|
+
* Log the last 2000 bytes of minifier's STDOUT output if the minifier
|
4
|
+
command fails. Pull Request #6 by Martin Nordholts (@Enselic).
|
5
|
+
* Allow prepending base URL for the destination path of `minibundle`
|
6
|
+
block
|
7
|
+
* Drop Ruby MRI 1.9 support because Jekyll 3 does not support it
|
8
|
+
* Fix issues in asset reloading in Jekyll's watch (auto-regeneration)
|
9
|
+
mode, doing bundling and asset fingerprinting again
|
10
|
+
|
1
11
|
# 1.5.1 / 2015-01-29
|
2
12
|
|
3
13
|
* Improve future compatibility with Jekyll. Minibundle has classes
|
@@ -8,7 +18,7 @@
|
|
8
18
|
# 1.5.0 / 2014-07-27
|
9
19
|
|
10
20
|
* Support minifier command specification in `_config.yml` and inside
|
11
|
-
`minibundle` block
|
21
|
+
`minibundle` block. Issue #4 by Phillip Smith (@phillipadsmith).
|
12
22
|
* Support enabling development mode from `_config.yml`
|
13
23
|
* Add argument validation to `minibundle` block and `ministamp` tag
|
14
24
|
* Document how to load the gem with Jekyll's `gems` config setting
|
@@ -25,8 +35,8 @@
|
|
25
35
|
* Clean log messages: show relative paths when bundling assets
|
26
36
|
* Add missing implementations of `relative_path` and `to_liquid`
|
27
37
|
methods from Jekyll's StaticFile API (introduced in Jekyll v1.5.0),
|
28
|
-
allowing Minibundle to behave better with other Jekyll
|
29
|
-
@mmistakes)
|
38
|
+
allowing Minibundle to behave better with other Jekyll
|
39
|
+
plugins. Issue #3 by Michael Rose (@mmistakes).
|
30
40
|
* Fix Ruby deprecation warnings (use `File.exist?` instead of
|
31
41
|
`File.exists?`)
|
32
42
|
|
@@ -65,14 +75,15 @@
|
|
65
75
|
* Fix bug causing exception to be thrown when `ministamp` or
|
66
76
|
`minibundle` is called twice with same asset source argument. Allow
|
67
77
|
handling asset source files that are already static files in Jekyll
|
68
|
-
(remove the restriction introduced in 1.3.0).
|
78
|
+
(remove the restriction introduced in 1.3.0). Issue #2 by Austin
|
79
|
+
Grigg (@agrigg).
|
69
80
|
|
70
81
|
# 1.3.0 / 2013-12-25
|
71
82
|
|
72
83
|
* Disallow handling asset source files that are already static files
|
73
84
|
in Jekyll. Otherwise, we would potentially get to inconsistencies in
|
74
85
|
Jekyll's watch mode. See "Jekyll static file restriction" in
|
75
|
-
README.md.
|
86
|
+
README.md. Issue #2 by Austin Grigg (@agrigg).
|
76
87
|
* Upgrade development dependencies
|
77
88
|
|
78
89
|
# 1.2.0 / 2013-09-29
|
@@ -85,7 +96,8 @@
|
|
85
96
|
|
86
97
|
* `ministamp` tag omits fingerprint in development mode
|
87
98
|
* Clarify documentation
|
88
|
-
* Comply with (Gemnasium) conventions for changelogs
|
99
|
+
* Comply with (Gemnasium) conventions for changelogs. Pull Request #1
|
100
|
+
by Teemu Matilainen (@tmatilai).
|
89
101
|
* Bug fix: do not bundle assets when nonrelated files change
|
90
102
|
* Bug fix: do not bundle assets twice upon startup
|
91
103
|
|
data/README.md
CHANGED
@@ -8,12 +8,12 @@ for cache busting.
|
|
8
8
|
There are no runtime dependencies, except for the minification tool
|
9
9
|
used for bundling (fingerprinting has no dependencies).
|
10
10
|
|
11
|
-
Tested with Ruby MRI
|
11
|
+
Tested with Ruby MRI 2.x. Ruby 1.9 and 1.8 are *not* supported.
|
12
12
|
|
13
13
|
The plugin works with Jekyll's watch (auto-regeneration) mode.
|
14
14
|
|
15
|
-
[![Gem
|
16
|
-
[![Build
|
15
|
+
[![Gem version](https://badge.fury.io/rb/jekyll-minibundle.svg)][MinibundleGem]
|
16
|
+
[![Build status](https://secure.travis-ci.org/tkareine/jekyll-minibundle.svg)][MinibundleBuild]
|
17
17
|
|
18
18
|
# Features
|
19
19
|
|
@@ -29,11 +29,11 @@ feeding asset file contents to it in desired order via standard input,
|
|
29
29
|
and reads the result from standard output.
|
30
30
|
|
31
31
|
Why is this good? A fingerprint in asset's path is the
|
32
|
-
[recommended way][
|
33
|
-
static resources, because you can allow
|
34
|
-
|
35
|
-
|
36
|
-
automatically.
|
32
|
+
[recommended way][GoogleWebFundamentalsHttpCaching] to handle caching
|
33
|
+
of static resources, because you can allow browsers and intermediate
|
34
|
+
proxies to cache the asset for a very long time. Calculating MD5
|
35
|
+
digest over the contents of the asset is fast and the resulting digest
|
36
|
+
is reasonably unique to be generated automatically.
|
37
37
|
|
38
38
|
Asset bundling is good for reducing the number of requests to the
|
39
39
|
backend upon page load. The minification of stylesheets and JavaScript
|
@@ -42,8 +42,7 @@ network.
|
|
42
42
|
|
43
43
|
# Usage
|
44
44
|
|
45
|
-
The plugin ships as a
|
46
|
-
[RubyGem](https://rubygems.org/gems/jekyll-minibundle). To install:
|
45
|
+
The plugin ships as a [RubyGem][MinibundleGem]. To install:
|
47
46
|
|
48
47
|
``` bash
|
49
48
|
$ gem install jekyll-minibundle
|
@@ -76,13 +75,14 @@ If you just want to have a fingerprint in your asset's path, use
|
|
76
75
|
`ministamp` tag:
|
77
76
|
|
78
77
|
``` html
|
79
|
-
<link href="{% ministamp _assets/site.css assets/site.css %}" rel="stylesheet" media="screen, projection">
|
78
|
+
<link href="{{ site.baseurl }}{% ministamp _assets/site.css assets/site.css %}" rel="stylesheet" media="screen, projection">
|
80
79
|
```
|
81
80
|
|
82
|
-
Output, containing the MD5 digest of the
|
81
|
+
Output, when `site.baseurl` is `/`, containing the MD5 digest of the
|
82
|
+
file in the filename:
|
83
83
|
|
84
84
|
``` html
|
85
|
-
<link href="assets/site-390be921ee0eff063817bb5ef2954300.css" rel="stylesheet" media="screen, projection">
|
85
|
+
<link href="/assets/site-390be921ee0eff063817bb5ef2954300.css" rel="stylesheet" media="screen, projection">
|
86
86
|
```
|
87
87
|
|
88
88
|
Jekyll's output directory will have the asset file at that path.
|
@@ -94,7 +94,7 @@ to take inputs from `_assets/styles/*.scss` and to produce output to
|
|
94
94
|
fingerprint to Jekyll's output directory:
|
95
95
|
|
96
96
|
``` html
|
97
|
-
<link href="{% ministamp _tmp/site.css assets/site.css %}" rel="stylesheet">
|
97
|
+
<link href="{{ site.baseurl }}{% ministamp _tmp/site.css assets/site.css %}" rel="stylesheet">
|
98
98
|
```
|
99
99
|
|
100
100
|
## Asset bundling
|
@@ -115,6 +115,7 @@ a set of JavaScript sources:
|
|
115
115
|
{% minibundle js %}
|
116
116
|
source_dir: _assets/scripts
|
117
117
|
destination_path: assets/site
|
118
|
+
baseurl: {{ site.baseurl }}
|
118
119
|
assets:
|
119
120
|
- dependency
|
120
121
|
- app
|
@@ -126,15 +127,17 @@ attributes:
|
|
126
127
|
Then, specify the command for launching your favorite minifier in `_config.yml`:
|
127
128
|
|
128
129
|
``` yaml
|
130
|
+
baseurl: /
|
131
|
+
|
129
132
|
minibundle:
|
130
133
|
minifier_commands:
|
131
|
-
js:
|
134
|
+
js: node_modules/.bin/uglifyjs --
|
132
135
|
```
|
133
136
|
|
134
137
|
Output in the content file:
|
135
138
|
|
136
139
|
``` html
|
137
|
-
<script src="assets/site-8e764372a0dbd296033cb2a416f064b5.js" type="text/javascript" id="my-scripts"></script>
|
140
|
+
<script src="/assets/site-8e764372a0dbd296033cb2a416f064b5.js" type="text/javascript" id="my-scripts"></script>
|
138
141
|
```
|
139
142
|
|
140
143
|
You can pass custom attributes, like `id="my-scripts"` above, to the
|
@@ -147,6 +150,7 @@ For bundling CSS assets, you use `css` as the argument to the
|
|
147
150
|
{% minibundle css %}
|
148
151
|
source_dir: _assets/styles
|
149
152
|
destination_path: assets/site
|
153
|
+
baseurl: {{ site.baseurl }}
|
150
154
|
assets:
|
151
155
|
- reset
|
152
156
|
- common
|
@@ -161,7 +165,7 @@ And then specify the minifier command in `_config.yml`:
|
|
161
165
|
minibundle:
|
162
166
|
minifier_commands:
|
163
167
|
css: _bin/remove_whitespace
|
164
|
-
js:
|
168
|
+
js: node_modules/.bin/uglifyjs --
|
165
169
|
```
|
166
170
|
|
167
171
|
### Minifier command specification
|
@@ -174,14 +178,14 @@ You can specify minifier commands in three places:
|
|
174
178
|
minibundle:
|
175
179
|
minifier_commands:
|
176
180
|
css: _bin/remove_whitespace
|
177
|
-
js:
|
181
|
+
js: node_modules/.bin/uglifyjs --
|
178
182
|
```
|
179
183
|
|
180
184
|
2. as environment variables:
|
181
185
|
|
182
186
|
``` bash
|
183
187
|
export JEKYLL_MINIBUNDLE_CMD_CSS=_bin/remove_whitespace
|
184
|
-
export JEKYLL_MINIBUNDLE_CMD_JS="
|
188
|
+
export JEKYLL_MINIBUNDLE_CMD_JS="node_modules/.bin/uglifyjs --"
|
185
189
|
```
|
186
190
|
|
187
191
|
3. inside the minibundle block with `minifier_cmd` setting, allowing
|
@@ -191,7 +195,7 @@ You can specify minifier commands in three places:
|
|
191
195
|
{% minibundle js %}
|
192
196
|
source_dir: _assets/scripts
|
193
197
|
destination_path: assets/site
|
194
|
-
minifier_cmd:
|
198
|
+
minifier_cmd: node_modules/.bin/uglifyjs --
|
195
199
|
assets:
|
196
200
|
- dependency
|
197
201
|
- app
|
@@ -217,7 +221,7 @@ asset source to `ministamp` tag:
|
|
217
221
|
|
218
222
|
``` html
|
219
223
|
<!-- BAD: unless assets dir is excluded, both src.css and dest.css will be copied to output directory -->
|
220
|
-
<link href="{% ministamp assets/src.css assets/dest.css %}" rel="stylesheet" media="screen, projection">
|
224
|
+
<link href="{{ site.baseurl }}{% ministamp assets/src.css assets/dest.css %}" rel="stylesheet" media="screen, projection">
|
221
225
|
```
|
222
226
|
|
223
227
|
By default, Jekyll includes this file to the output directory. As a
|
@@ -266,13 +270,19 @@ wins.
|
|
266
270
|
|
267
271
|
See the contents of `test/fixture/site` directory.
|
268
272
|
|
273
|
+
# Known caveats
|
274
|
+
|
275
|
+
See `test/integration/known_caveats_test.rb`.
|
276
|
+
|
269
277
|
# License
|
270
278
|
|
271
279
|
MIT. See `LICENSE.txt`.
|
272
280
|
|
273
281
|
[Compass]: http://compass-style.org/
|
274
282
|
[GemBundler]: http://bundler.io/
|
275
|
-
[
|
276
|
-
[
|
277
|
-
[
|
283
|
+
[GoogleWebFundamentalsHttpCaching]: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching#invalidating-and-updating-cached-responses
|
284
|
+
[MinibundleGem]: https://rubygems.org/gems/jekyll-minibundle
|
285
|
+
[MinibundleBuild]: https://travis-ci.org/tkareine/jekyll-minibundle
|
286
|
+
[Jekyll]: https://jekyllrb.com/
|
287
|
+
[JekyllConf]: https://jekyllrb.com/docs/configuration/
|
278
288
|
[UglifyJS2]: https://github.com/mishoo/UglifyJS2
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'rake/clean'
|
3
3
|
require 'shellwords'
|
4
|
+
require 'rubocop/rake_task'
|
4
5
|
|
5
6
|
require_relative 'lib/jekyll/minibundle/version'
|
6
7
|
|
@@ -25,7 +26,7 @@ namespace :gem do
|
|
25
26
|
CLEAN.include "#{gem_name}-*.gem"
|
26
27
|
|
27
28
|
desc 'Package the software as a gem'
|
28
|
-
task :
|
29
|
+
task build: :default do
|
29
30
|
sh "gem build #{gem_name}.gemspec"
|
30
31
|
end
|
31
32
|
|
@@ -35,7 +36,7 @@ namespace :gem do
|
|
35
36
|
end
|
36
37
|
|
37
38
|
desc 'Uninstall the gem'
|
38
|
-
task :
|
39
|
+
task uninstall: :clean do
|
39
40
|
sh "gem uninstall #{gem_name}"
|
40
41
|
end
|
41
42
|
end
|
@@ -44,17 +45,19 @@ desc 'Run tests; TEST=<test_suite_path>, NAME=<test_name_pattern>, DEBUG=1 to re
|
|
44
45
|
task :test do
|
45
46
|
run_single_test = ENV.key?('TEST')
|
46
47
|
|
47
|
-
run_selected_or_all =
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
run_selected_or_all =
|
49
|
+
if run_single_test
|
50
|
+
rb_file = ENV['TEST']
|
51
|
+
name_opt = ENV.key?('NAME') ? " -n #{ENV['NAME']}" : ''
|
52
|
+
"#{rb_file}#{name_opt}"
|
53
|
+
else
|
54
|
+
requirable_files =
|
55
|
+
Dir['test/{unit,integration}/*_test.rb']
|
56
|
+
.map { |file| %r{^test/(.+)\.rb$}.match(file)[1] }
|
57
|
+
.shelljoin
|
58
|
+
eval = "-e 'ARGV.each { |f| require f }'"
|
59
|
+
"#{eval} #{requirable_files}"
|
60
|
+
end
|
58
61
|
|
59
62
|
extra_opts = ENV['DEBUG'] ? '-w -rpp -rpry ' : ''
|
60
63
|
|
@@ -75,4 +78,6 @@ namespace :fixture do
|
|
75
78
|
end
|
76
79
|
end
|
77
80
|
|
78
|
-
|
81
|
+
RuboCop::RakeTask.new
|
82
|
+
|
83
|
+
task default: [:test, :rubocop]
|
data/jekyll-minibundle.gemspec
CHANGED
@@ -27,12 +27,13 @@ minification tool (not even other gems).
|
|
27
27
|
|
28
28
|
s.test_files = `git ls-files -- test`.split("\n")
|
29
29
|
|
30
|
-
s.add_development_dependency 'jekyll', '~>
|
31
|
-
s.add_development_dependency 'minitest', '~> 5.
|
30
|
+
s.add_development_dependency 'jekyll', '~> 3.1'
|
31
|
+
s.add_development_dependency 'minitest', '~> 5.8'
|
32
32
|
s.add_development_dependency 'nokogiri', '~> 1.6'
|
33
|
-
s.add_development_dependency 'rake', '~>
|
33
|
+
s.add_development_dependency 'rake', '~> 11.1'
|
34
|
+
s.add_development_dependency 'rubocop', '~> 0.38.0'
|
34
35
|
|
35
|
-
s.required_ruby_version = '>=
|
36
|
+
s.required_ruby_version = '>= 2.0.0'
|
36
37
|
|
37
38
|
s.rdoc_options << '--line-numbers' << '--title' << s.name << '--exclude' << 'test'
|
38
39
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'jekyll/minibundle/compatibility'
|
3
|
+
require 'jekyll/minibundle/files'
|
3
4
|
|
4
5
|
module Jekyll::Minibundle
|
5
6
|
class AssetBundle
|
@@ -10,7 +11,7 @@ module Jekyll::Minibundle
|
|
10
11
|
@minifier_cmd = config.fetch(:minifier_cmd)
|
11
12
|
|
12
13
|
unless @minifier_cmd
|
13
|
-
|
14
|
+
raise <<-END
|
14
15
|
Missing minification command for bundling #{@type} assets. Specify it in
|
15
16
|
1) minibundle.minifier_commands.#{@type} setting in _config.yml,
|
16
17
|
2) $JEKYLL_MINIBUNDLE_CMD_#{@type.to_s.upcase} environment variable, or
|
@@ -18,7 +19,7 @@ Missing minification command for bundling #{@type} assets. Specify it in
|
|
18
19
|
END
|
19
20
|
end
|
20
21
|
|
21
|
-
@temp_file = Tempfile.new([
|
22
|
+
@temp_file = Tempfile.new(['jekyll-minibundle-', ".#{@type}"])
|
22
23
|
at_exit { @temp_file.close! }
|
23
24
|
end
|
24
25
|
|
@@ -36,14 +37,18 @@ Missing minification command for bundling #{@type} assets. Specify it in
|
|
36
37
|
input.puts(';') if @type == :js
|
37
38
|
end
|
38
39
|
end
|
39
|
-
|
40
|
+
if exit_status != 0
|
41
|
+
msg = "Bundling #{@type} assets failed with exit status #{exit_status}, command: '#{@minifier_cmd}'"
|
42
|
+
log_minifier_error(msg)
|
43
|
+
raise msg
|
44
|
+
end
|
40
45
|
self
|
41
46
|
end
|
42
47
|
|
43
48
|
private
|
44
49
|
|
45
50
|
def relative_path_from(path, base)
|
46
|
-
path.sub(
|
51
|
+
path.sub(%r{\A#{base}/}, '')
|
47
52
|
end
|
48
53
|
|
49
54
|
def spawn_minifier(cmd)
|
@@ -57,8 +62,23 @@ Missing minification command for bundling #{@type} assets. Specify it in
|
|
57
62
|
wr.close
|
58
63
|
_, status = Process.waitpid2(pid)
|
59
64
|
status.exitstatus
|
65
|
+
rescue => e
|
66
|
+
raise "Bundling #{@type} assets failed: #{e}"
|
60
67
|
ensure
|
61
68
|
[rd, wr].each { |io| io.close unless io.closed? }
|
62
69
|
end
|
70
|
+
|
71
|
+
def log_minifier_error(message)
|
72
|
+
last_bytes = Files.read_last(@temp_file.path, 2000)
|
73
|
+
|
74
|
+
return if last_bytes.empty?
|
75
|
+
|
76
|
+
Compatibility.log_error("#{message}, last #{last_bytes.size} bytes of minifier output:")
|
77
|
+
|
78
|
+
last_bytes
|
79
|
+
.gsub(/[^[:print:]\t\n]/) { |ch| '\x' + ch.unpack('H2').first }
|
80
|
+
.split("\n")
|
81
|
+
.each { |line| Compatibility.log_error(line) }
|
82
|
+
end
|
63
83
|
end
|
64
84
|
end
|
@@ -2,14 +2,6 @@ require 'fileutils'
|
|
2
2
|
|
3
3
|
module Jekyll::Minibundle
|
4
4
|
module AssetFileOperations
|
5
|
-
def add_as_static_file_to(site)
|
6
|
-
# NOTE: Rely on explicit site parameter (not on self's @site) so
|
7
|
-
# that we can utilize asset registry clearing for tests.
|
8
|
-
unless site.static_files.include? self
|
9
|
-
site.static_files << self
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
5
|
def write_destination(site_destination_dir)
|
14
6
|
destination_path = destination(site_destination_dir)
|
15
7
|
FileUtils.mkdir_p(File.dirname(destination_path))
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module Jekyll::Minibundle
|
2
2
|
module AssetFileProperties
|
3
|
+
def asset_destination_path
|
4
|
+
File.join(asset_destination_dir, asset_destination_basename)
|
5
|
+
end
|
6
|
+
|
7
|
+
# Conformance to remaining Jekyll StaticFile public API methods
|
8
|
+
|
3
9
|
def path
|
4
10
|
asset_source_path
|
5
11
|
end
|
@@ -8,20 +14,20 @@ module Jekyll::Minibundle
|
|
8
14
|
path.sub(/\A#{@site.source}/, '')
|
9
15
|
end
|
10
16
|
|
11
|
-
def asset_destination_path
|
12
|
-
File.join(asset_destination_dir, asset_destination_basename)
|
13
|
-
end
|
14
|
-
|
15
17
|
def destination(site_destination_dir)
|
16
18
|
File.join(site_destination_dir, asset_destination_path)
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
20
|
-
|
21
|
+
def url
|
22
|
+
asset_destination_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def modified_time
|
26
|
+
File.stat(path).mtime
|
21
27
|
end
|
22
28
|
|
23
29
|
def mtime
|
24
|
-
|
30
|
+
modified_time.to_i
|
25
31
|
end
|
26
32
|
|
27
33
|
def modified?
|
@@ -35,7 +41,7 @@ module Jekyll::Minibundle
|
|
35
41
|
def to_liquid
|
36
42
|
{
|
37
43
|
'path' => relative_path,
|
38
|
-
'modified_time' =>
|
44
|
+
'modified_time' => modified_time,
|
39
45
|
'extname' => extname
|
40
46
|
}
|
41
47
|
end
|
@@ -43,5 +49,17 @@ module Jekyll::Minibundle
|
|
43
49
|
def write?
|
44
50
|
true
|
45
51
|
end
|
52
|
+
|
53
|
+
def type
|
54
|
+
nil # no collection present
|
55
|
+
end
|
56
|
+
|
57
|
+
def defaults
|
58
|
+
{}
|
59
|
+
end
|
60
|
+
|
61
|
+
def placeholders
|
62
|
+
{}
|
63
|
+
end
|
46
64
|
end
|
47
65
|
end
|