jekyll-minibundle 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +91 -61
- data/jekyll-minibundle.gemspec +6 -5
- data/lib/jekyll/minibundle/asset_file_operations.rb +1 -0
- data/lib/jekyll/minibundle/asset_file_properties.rb +9 -3
- data/lib/jekyll/minibundle/bundle_file.rb +17 -15
- data/lib/jekyll/minibundle/development_file.rb +3 -3
- data/lib/jekyll/minibundle/stamp_file.rb +11 -10
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/integration/minibundle_development_mode_test.rb +13 -13
- data/test/integration/minibundle_production_mode_test.rb +32 -21
- data/test/integration/ministamp_development_mode_test.rb +9 -9
- data/test/integration/ministamp_production_mode_test.rb +7 -7
- data/test/support/static_file_api_config.rb +1 -0
- data/test/support/test_case.rb +22 -6
- data/test/unit/bundle_file_properties_test.rb +22 -15
- data/test/unit/bundle_file_writing_test.rb +7 -7
- data/test/unit/development_file_collection_properties_test.rb +39 -30
- data/test/unit/jekyll_static_file_api_test.rb +71 -0
- data/test/unit/stamp_file_properties_test.rb +22 -15
- data/test/unit/stamp_file_writing_test.rb +5 -5
- metadata +24 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c07644674d4019624ae3cd17463a8dc961df66ba
|
4
|
+
data.tar.gz: f512236902087572a1d618620ac87184f8590b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3886e4b0a47bfa8d9aa720c0b5630952fd876835f29b9cfe55b5df11bb726ff51f9ff91defd338e64e9b7e44687f692b069aeb246f21be126793b3f139963428
|
7
|
+
data.tar.gz: 320e44f066004bf6a701ea26a0bdc42a507211656d9f446ea20da84cb67b5f5c0468afe2d7b2e70ac4919a34cad2a41b773c3f6c8319faa03f7667a8abe1bb07
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 2.1.1 / 2017-01-14
|
2
|
+
|
3
|
+
* Fix the file permissions of `minibundle` block's output file to
|
4
|
+
respect umask setting. Bug report from Alfonse Surigao.
|
5
|
+
* Compatibility: conform to Jekyll 3.3's StaticFile public API
|
6
|
+
|
1
7
|
# 2.1.0 / 2016-05-04
|
2
8
|
|
3
9
|
* Allow attributes without values. Useful for `async` attribute, for
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# Jekyll Minibundle plugin
|
2
2
|
|
3
|
-
A straightforward asset bundling plugin for [Jekyll][Jekyll],
|
4
|
-
|
5
|
-
concatenation for bundling and asset fingerprinting with MD5 digest
|
6
|
-
|
3
|
+
A straightforward asset bundling plugin for [Jekyll][Jekyll], utilizing
|
4
|
+
external minification tool of your choice. It provides asset
|
5
|
+
concatenation for bundling and asset fingerprinting with MD5 digest for
|
6
|
+
cache busting.
|
7
7
|
|
8
|
-
There are no runtime dependencies, except for the minification tool
|
9
|
-
|
8
|
+
There are no runtime dependencies, except for the minification tool used
|
9
|
+
for bundling (fingerprinting has no dependencies).
|
10
10
|
|
11
11
|
The plugin requires Jekyll version 3.x. It is tested with Ruby MRI
|
12
12
|
2.x. Ruby 1.8 and 1.9 are *not* supported.
|
@@ -20,28 +20,27 @@ option `--incremental`).
|
|
20
20
|
|
21
21
|
## Features
|
22
22
|
|
23
|
-
There are two features: asset fingerprinting with MD5 digest over
|
24
|
-
contents of the asset, and asset bundling combined with the first
|
23
|
+
There are two features: asset fingerprinting with [MD5 digest][MD5] over
|
24
|
+
the contents of the asset, and asset bundling combined with the first
|
25
25
|
feature.
|
26
26
|
|
27
27
|
Asset bundling consists of concatenation and minification. The plugin
|
28
|
-
implements concatenation and leaves choosing the minification tool up
|
29
|
-
|
28
|
+
implements concatenation and leaves choosing the minification tool up to
|
29
|
+
you. [UglifyJS2][UglifyJS2] is a good and fast minifier, for
|
30
30
|
example. The plugin connects to the minifier with standard unix pipe,
|
31
31
|
feeding asset file contents to it in desired order via standard input,
|
32
32
|
and reads the result from standard output.
|
33
33
|
|
34
|
-
Why is this good? A fingerprint in asset's path is
|
35
|
-
[recommended way][GoogleWebFundamentalsHttpCaching] to handle
|
36
|
-
of static resources, because you can allow browsers and
|
37
|
-
proxies to cache the asset for a very long
|
38
|
-
digest over the contents of the asset is fast and
|
39
|
-
is reasonably unique to be generated automatically.
|
34
|
+
Why is this good? A fingerprint in asset's path is
|
35
|
+
the [recommended way][GoogleWebFundamentalsHttpCaching] to handle
|
36
|
+
caching of static resources, because you can allow browsers and
|
37
|
+
intermediate proxies to cache the asset for a very long
|
38
|
+
time. Calculating MD5 digest over the contents of the asset is fast and
|
39
|
+
the resulting digest is reasonably unique to be generated automatically.
|
40
40
|
|
41
41
|
Asset bundling is good for reducing the number of requests to the
|
42
42
|
backend upon page load. The minification of stylesheets and JavaScript
|
43
|
-
sources makes asset sizes smaller and thus faster to load over
|
44
|
-
network.
|
43
|
+
sources makes asset sizes smaller and thus faster to load over network.
|
45
44
|
|
46
45
|
## Usage
|
47
46
|
|
@@ -51,8 +50,7 @@ The plugin ships as a [RubyGem][MinibundleGem]. To install:
|
|
51
50
|
$ gem install jekyll-minibundle
|
52
51
|
```
|
53
52
|
|
54
|
-
(You should use [Bundler][
|
55
|
-
project.)
|
53
|
+
(You should use [Bundler][Bundler] to manage the gems in your project.)
|
56
54
|
|
57
55
|
Then, instruct Jekyll to load the gem by adding this line to the
|
58
56
|
[configuration file][JekyllConf] of your Jekyll site project
|
@@ -74,25 +72,27 @@ Jekyll's `safe` setting.
|
|
74
72
|
|
75
73
|
### Asset fingerprinting
|
76
74
|
|
77
|
-
If you just want to have
|
78
|
-
`ministamp` tag:
|
75
|
+
If you just want to have an MD5 fingerprint in your asset's path, use
|
76
|
+
`ministamp` [Liquid][Liquid] tag. For example:
|
79
77
|
|
80
78
|
``` html
|
81
79
|
<link href="{{ site.baseurl }}{% ministamp _assets/site.css assets/site.css %}" rel="stylesheet" media="screen, projection">
|
82
80
|
```
|
83
81
|
|
84
|
-
|
85
|
-
file
|
82
|
+
When it's time to render the `ministamp` tag, the plugin copies the
|
83
|
+
source file (`_assets/site.css`, the first tag argument) to the
|
84
|
+
specified destination path (`assets/site.css`, the second tag argument)
|
85
|
+
in Jekyll's output directory. The filename will contain a fingerprint.
|
86
|
+
|
87
|
+
Tag output, when `site.baseurl` is `/`:
|
86
88
|
|
87
89
|
``` html
|
88
90
|
<link href="/assets/site-390be921ee0eff063817bb5ef2954300.css" rel="stylesheet" media="screen, projection">
|
89
91
|
```
|
90
92
|
|
91
|
-
Jekyll's output directory will have the asset file at that path.
|
92
|
-
|
93
93
|
This feature is useful when combined with asset generation tools
|
94
|
-
external to Jekyll. For example, you can configure [
|
95
|
-
|
94
|
+
external to Jekyll. For example, you can configure [Sass][Sass] to take
|
95
|
+
input files from `_assets/styles/*.scss` and to produce output to
|
96
96
|
`_tmp/site.css`. Then, you use `ministamp` tag to copy the file with a
|
97
97
|
fingerprint to Jekyll's output directory:
|
98
98
|
|
@@ -104,15 +104,16 @@ fingerprint to Jekyll's output directory:
|
|
104
104
|
|
105
105
|
This is a straightforward way to bundle assets with any minification
|
106
106
|
tool that supports reading input from STDIN and writing the output to
|
107
|
-
STDOUT. You write the configuration for input sources directly into
|
108
|
-
|
109
|
-
appear. The
|
110
|
-
|
111
|
-
|
107
|
+
STDOUT. You write the configuration for input sources directly into the
|
108
|
+
content file where you want the markup tag for the bundle file to
|
109
|
+
appear. The markup tag contains the path to the bundle file, and the
|
110
|
+
Jekyll's output directory will have the bundle file at that path. The
|
111
|
+
path will contain an MD5 fingerprint.
|
112
112
|
|
113
|
-
Place `minibundle` block
|
114
|
-
|
115
|
-
a set of
|
113
|
+
Place `minibundle` [Liquid][Liquid] block into your content file where
|
114
|
+
you want the generated markup to appear. Write bundling configuration
|
115
|
+
inside the block in [YAML][YAML] syntax. For example, to bundle a set of
|
116
|
+
JavaScript sources:
|
116
117
|
|
117
118
|
``` text
|
118
119
|
{% minibundle js %}
|
@@ -128,17 +129,27 @@ attributes:
|
|
128
129
|
{% endminibundle %}
|
129
130
|
```
|
130
131
|
|
131
|
-
Then, specify the command for launching your favorite minifier in
|
132
|
+
Then, specify the command for launching your favorite minifier in
|
133
|
+
`_config.yml`:
|
132
134
|
|
133
135
|
``` yaml
|
134
136
|
baseurl: /
|
135
137
|
|
136
138
|
minibundle:
|
137
139
|
minifier_commands:
|
138
|
-
js: node_modules/.bin/uglifyjs
|
140
|
+
js: node_modules/.bin/uglifyjs -
|
139
141
|
```
|
140
142
|
|
141
|
-
|
143
|
+
When it's time to render the `minibundle` block, the plugin launches the
|
144
|
+
minifier and connects to it with a Unix pipe. The plugin feeds the
|
145
|
+
contents of the asset files in `source_dir` directory as input to the
|
146
|
+
minifier (STDIN). The feeding order is the order of the files in the
|
147
|
+
`assets` key in the block configuration. The plugin expects the minifier
|
148
|
+
to produce output (STDOUT) and writes it to the file at
|
149
|
+
`destination_path` in Jekyll's output directory. The filename will
|
150
|
+
contain a fingerprint.
|
151
|
+
|
152
|
+
Block output in the content file:
|
142
153
|
|
143
154
|
``` html
|
144
155
|
<script src="/assets/site-8e764372a0dbd296033cb2a416f064b5.js" type="text/javascript" id="my-scripts" async></script>
|
@@ -170,7 +181,7 @@ And then specify the minifier command in `_config.yml`:
|
|
170
181
|
minibundle:
|
171
182
|
minifier_commands:
|
172
183
|
css: _bin/remove_whitespace
|
173
|
-
js: node_modules/.bin/uglifyjs
|
184
|
+
js: node_modules/.bin/uglifyjs -
|
174
185
|
```
|
175
186
|
|
176
187
|
### Minifier command specification
|
@@ -183,14 +194,14 @@ You can specify minifier commands in three places:
|
|
183
194
|
minibundle:
|
184
195
|
minifier_commands:
|
185
196
|
css: _bin/remove_whitespace
|
186
|
-
js: node_modules/.bin/uglifyjs
|
197
|
+
js: node_modules/.bin/uglifyjs -
|
187
198
|
```
|
188
199
|
|
189
200
|
2. as environment variables:
|
190
201
|
|
191
202
|
``` bash
|
192
203
|
export JEKYLL_MINIBUNDLE_CMD_CSS=_bin/remove_whitespace
|
193
|
-
export JEKYLL_MINIBUNDLE_CMD_JS="node_modules/.bin/uglifyjs
|
204
|
+
export JEKYLL_MINIBUNDLE_CMD_JS="node_modules/.bin/uglifyjs -"
|
194
205
|
```
|
195
206
|
|
196
207
|
3. inside the minibundle block with `minifier_cmd` setting, allowing
|
@@ -200,7 +211,7 @@ You can specify minifier commands in three places:
|
|
200
211
|
{% minibundle js %}
|
201
212
|
source_dir: _assets/scripts
|
202
213
|
destination_path: assets/site
|
203
|
-
minifier_cmd: node_modules/.bin/uglifyjs
|
214
|
+
minifier_cmd: node_modules/.bin/uglifyjs -
|
204
215
|
assets:
|
205
216
|
- dependency
|
206
217
|
- app
|
@@ -239,9 +250,8 @@ character (`_`), consider using the following directory layout:
|
|
239
250
|
|
240
251
|
* `_assets/` for JavaScript and CSS assets handled by the plugin that
|
241
252
|
are in version control
|
242
|
-
* `_tmp/` for temporary JavaScript and CSS assets handled by the
|
243
|
-
|
244
|
-
files)
|
253
|
+
* `_tmp/` for temporary JavaScript and CSS assets handled by the plugin
|
254
|
+
that are not in version control (for example, Sass output files)
|
245
255
|
* `assets/` for images and other assets handled by Jekyll directly
|
246
256
|
|
247
257
|
See [Jekyll configuration][JekyllConf] for more about excluding files
|
@@ -249,11 +259,10 @@ and directories.
|
|
249
259
|
|
250
260
|
### Development mode
|
251
261
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
`minibundle` block sets the destination directory for bundled
|
262
|
+
If you set `$JEKYLL_MINIBUNDLE_MODE` environment variable to
|
263
|
+
`development`, then the plugin will copy asset files as is to Jekyll's
|
264
|
+
output directory and omit fingerprinting. The `destination_path` setting
|
265
|
+
in `minibundle` block sets the destination directory for bundled
|
257
266
|
files. This is useful in development workflow, where you need the
|
258
267
|
filenames and line numbers of the original asset sources.
|
259
268
|
|
@@ -268,27 +277,48 @@ minibundle:
|
|
268
277
|
mode: development
|
269
278
|
```
|
270
279
|
|
271
|
-
Should both be defined, the setting from the environment variable
|
272
|
-
|
280
|
+
Should both be defined, the setting from the environment variable wins.
|
281
|
+
|
282
|
+
### Capturing Liquid output
|
283
|
+
|
284
|
+
Use Liquid's `capture` block to store output rendered inside the block
|
285
|
+
to a variable, as a string. Then you can process the string.
|
286
|
+
|
287
|
+
For example:
|
288
|
+
|
289
|
+
``` html
|
290
|
+
{% capture sitecss %}{% ministamp _assets/site.css assets/site.css %}{% endcapture %}
|
291
|
+
<link href="{{ site.cdnbaseurl }}{{ sitecss | remove_first: "assets/"}}" rel="stylesheet" media="screen, projection">
|
292
|
+
```
|
293
|
+
|
294
|
+
Output, provided `site.cdnbaseurl` is set to `https://cdn.example.com/`:
|
295
|
+
|
296
|
+
``` html
|
297
|
+
<link href="https://cdn.example.com/site-390be921ee0eff063817bb5ef2954300.css" rel="stylesheet" media="screen, projection">
|
298
|
+
```
|
273
299
|
|
274
300
|
## Example site
|
275
301
|
|
276
|
-
See the
|
302
|
+
See the sources of [an example site][JekyllMinibundleExampleSite].
|
277
303
|
|
278
304
|
## Known caveats
|
279
305
|
|
280
|
-
The plugin does not work with Jekyll's incremental rebuild feature
|
281
|
-
option `--incremental`).
|
306
|
+
The plugin does not work with Jekyll's incremental rebuild feature
|
307
|
+
(Jekyll option `--incremental`).
|
282
308
|
|
283
309
|
## License
|
284
310
|
|
285
311
|
MIT. See `LICENSE.txt`.
|
286
312
|
|
287
|
-
[
|
288
|
-
[GemBundler]: http://bundler.io/
|
313
|
+
[Bundler]: http://bundler.io/
|
289
314
|
[GoogleWebFundamentalsHttpCaching]: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching#invalidating-and-updating-cached-responses
|
290
|
-
[MinibundleGem]: https://rubygems.org/gems/jekyll-minibundle
|
291
|
-
[MinibundleBuild]: https://travis-ci.org/tkareine/jekyll-minibundle
|
292
|
-
[Jekyll]: https://jekyllrb.com/
|
293
315
|
[JekyllConf]: https://jekyllrb.com/docs/configuration/
|
316
|
+
[JekyllMinibundleExampleSite]: https://github.com/tkareine/jekyll-minibundle-example
|
317
|
+
[Jekyll]: https://jekyllrb.com/
|
318
|
+
[Liquid]: https://shopify.github.io/liquid/
|
319
|
+
[MD5]: https://en.wikipedia.org/wiki/MD5
|
320
|
+
[MinibundleBuild]: https://travis-ci.org/tkareine/jekyll-minibundle
|
321
|
+
[MinibundleGem]: https://rubygems.org/gems/jekyll-minibundle
|
322
|
+
[Sass]: http://sass-lang.com/
|
294
323
|
[UglifyJS2]: https://github.com/mishoo/UglifyJS2
|
324
|
+
[YAML]: http://www.yaml.org/
|
data/jekyll-minibundle.gemspec
CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.description = <<-END
|
13
13
|
A straightforward asset bundling plugin for Jekyll, utilizing external
|
14
14
|
minification tool of your choice. It provides asset concatenation for
|
15
|
-
bundling and asset fingerprinting with MD5 digest for cache
|
16
|
-
|
17
|
-
|
15
|
+
bundling and asset fingerprinting with MD5 digest for cache busting.
|
16
|
+
There are no other runtime dependencies besides the minification tool
|
17
|
+
(not even other gems).
|
18
18
|
END
|
19
19
|
|
20
20
|
s.files = %w{
|
@@ -30,8 +30,9 @@ minification tool (not even other gems).
|
|
30
30
|
s.add_development_dependency 'jekyll', '~> 3.0'
|
31
31
|
s.add_development_dependency 'minitest', '~> 5.8'
|
32
32
|
s.add_development_dependency 'nokogiri', '~> 1.6'
|
33
|
-
s.add_development_dependency '
|
34
|
-
s.add_development_dependency '
|
33
|
+
s.add_development_dependency 'pry', '~> 0.10'
|
34
|
+
s.add_development_dependency 'rake', '~> 12.0'
|
35
|
+
s.add_development_dependency 'rubocop', '~> 0.46.0'
|
35
36
|
|
36
37
|
s.required_ruby_version = '>= 2.0.0'
|
37
38
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Jekyll::Minibundle
|
2
2
|
module AssetFileProperties
|
3
3
|
def asset_destination_path
|
4
|
-
File.join(asset_destination_dir,
|
4
|
+
File.join(asset_destination_dir, asset_destination_filename)
|
5
5
|
end
|
6
6
|
|
7
7
|
# Conformance to remaining Jekyll StaticFile public API methods
|
@@ -22,6 +22,10 @@ module Jekyll::Minibundle
|
|
22
22
|
asset_destination_path
|
23
23
|
end
|
24
24
|
|
25
|
+
def name
|
26
|
+
asset_destination_filename
|
27
|
+
end
|
28
|
+
|
25
29
|
def modified_time
|
26
30
|
File.stat(path).mtime
|
27
31
|
end
|
@@ -40,9 +44,11 @@ module Jekyll::Minibundle
|
|
40
44
|
|
41
45
|
def to_liquid
|
42
46
|
{
|
43
|
-
'
|
47
|
+
'basename' => File.basename(name, extname),
|
48
|
+
'name' => name,
|
49
|
+
'extname' => extname,
|
44
50
|
'modified_time' => modified_time,
|
45
|
-
'
|
51
|
+
'path' => relative_path
|
46
52
|
}
|
47
53
|
end
|
48
54
|
|
@@ -8,14 +8,16 @@ module Jekyll::Minibundle
|
|
8
8
|
include AssetFileOperations
|
9
9
|
include AssetFileProperties
|
10
10
|
|
11
|
-
attr_reader :stamped_at
|
11
|
+
attr_reader :asset_destination_dir, :stamped_at
|
12
12
|
|
13
13
|
def initialize(site, config)
|
14
14
|
@site = site
|
15
15
|
@type = config.fetch('type')
|
16
16
|
asset_source_dir = File.join(@site.source, config.fetch('source_dir'))
|
17
17
|
@asset_paths = config.fetch('assets').map { |asset_path| File.join(asset_source_dir, "#{asset_path}.#{@type}") }
|
18
|
-
|
18
|
+
destination_path = config.fetch('destination_path')
|
19
|
+
@asset_destination_dir = File.dirname(destination_path)
|
20
|
+
@asset_destination_filename_prefix = File.basename(destination_path)
|
19
21
|
@minifier_cmd = config.fetch('minifier_cmd')
|
20
22
|
@stamped_at = nil
|
21
23
|
@is_modified = false
|
@@ -30,8 +32,8 @@ module Jekyll::Minibundle
|
|
30
32
|
|
31
33
|
def destination_path_for_markup
|
32
34
|
# we must rebundle here, if at all, in order to make sure the
|
33
|
-
#
|
34
|
-
# fingerprint
|
35
|
+
# destination path in the markup and the generated file path
|
36
|
+
# have the same fingerprint
|
35
37
|
if modified?
|
36
38
|
@stamped_at = mtime
|
37
39
|
@is_modified = true
|
@@ -42,16 +44,12 @@ module Jekyll::Minibundle
|
|
42
44
|
asset_destination_path
|
43
45
|
end
|
44
46
|
|
45
|
-
def
|
47
|
+
def asset_source_path
|
46
48
|
asset_bundle.path
|
47
49
|
end
|
48
50
|
|
49
|
-
def
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def asset_destination_path
|
54
|
-
"#{@destination_path}-#{asset_stamp}.#{@type}"
|
51
|
+
def asset_destination_filename
|
52
|
+
"#{@asset_destination_filename_prefix}-#{asset_stamp}#{extname}"
|
55
53
|
end
|
56
54
|
|
57
55
|
def extname
|
@@ -62,11 +60,15 @@ module Jekyll::Minibundle
|
|
62
60
|
@asset_paths.map { |f| File.stat(f).mtime }.max
|
63
61
|
end
|
64
62
|
|
65
|
-
#
|
66
|
-
# been called
|
63
|
+
# allows writing destination only after
|
64
|
+
# `destination_path_for_markup` has been called
|
67
65
|
def write(site_destination_dir)
|
68
66
|
if @is_modified
|
69
|
-
write_destination(site_destination_dir)
|
67
|
+
dst_path = write_destination(site_destination_dir)
|
68
|
+
|
69
|
+
# respect user's umask; Ruby's tempfile has mode 0o600
|
70
|
+
File.chmod(0o666 & ~File.umask, dst_path)
|
71
|
+
|
70
72
|
@is_modified = false
|
71
73
|
true
|
72
74
|
else
|
@@ -77,7 +79,7 @@ module Jekyll::Minibundle
|
|
77
79
|
private
|
78
80
|
|
79
81
|
def asset_stamp
|
80
|
-
@_asset_stamp ||= AssetStamp.from_file(
|
82
|
+
@_asset_stamp ||= AssetStamp.from_file(asset_source_path)
|
81
83
|
end
|
82
84
|
|
83
85
|
def asset_bundle
|
@@ -6,20 +6,20 @@ module Jekyll::Minibundle
|
|
6
6
|
include AssetFileOperations
|
7
7
|
include AssetFileProperties
|
8
8
|
|
9
|
-
attr_reader :asset_source_path, :asset_destination_dir, :
|
9
|
+
attr_reader :asset_source_path, :asset_destination_dir, :asset_destination_filename, :stamped_at
|
10
10
|
|
11
11
|
def initialize(site, asset_source_path, asset_destination_path)
|
12
12
|
@site = site
|
13
13
|
@asset_source_path = asset_source_path
|
14
14
|
@asset_destination_dir = File.dirname(asset_destination_path)
|
15
|
-
@
|
15
|
+
@asset_destination_filename = File.basename(asset_destination_path)
|
16
16
|
@stamped_at = nil
|
17
17
|
end
|
18
18
|
|
19
19
|
alias destination_path_for_markup asset_destination_path
|
20
20
|
|
21
21
|
def extname
|
22
|
-
File.extname(
|
22
|
+
File.extname(asset_destination_filename)
|
23
23
|
end
|
24
24
|
|
25
25
|
def write(site_destination_dir)
|