jekyll-assets 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +7 -0
- data/README.md +15 -13
- data/jekyll-assets.gemspec +1 -1
- data/lib/jekyll/assets_plugin.rb +1 -0
- data/lib/jekyll/assets_plugin/commands.rb +16 -0
- data/lib/jekyll/assets_plugin/configuration.rb +12 -5
- data/lib/jekyll/assets_plugin/environment.rb +13 -0
- data/lib/jekyll/assets_plugin/version.rb +1 -1
- data/spec/fixtures/.gitignore +1 -0
- data/spec/lib/jekyll/assets_plugin/configuration_spec.rb +5 -0
- data/spec/lib/jekyll/assets_plugin/patches/site_patch_spec.rb +7 -0
- metadata +4 -3
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -170,11 +170,6 @@ body
|
|
170
170
|
background-color: <%= (12 == Date.today.month) ? "red" : "white" %>
|
171
171
|
```
|
172
172
|
|
173
|
-
*Note* that all assets are pre-processed with Liquid. So if you just need to
|
174
|
-
output asset URL within your javascript/coffeescript or pure css, you don't
|
175
|
-
need to use ERB, just use `asset_path` Liquid tag same as you do it in your
|
176
|
-
layouts/pages. See "Liquid Assets Pre-processing" for more details.
|
177
|
-
|
178
173
|
Want more? Sure, here you are. You can use JavaScript templating with EJS or ECO
|
179
174
|
for example. Create a file `_assets/javascripts/hello.jst.ejs` with following
|
180
175
|
contents:
|
@@ -215,16 +210,17 @@ assets:
|
|
215
210
|
[amazon-s3]: http://aws.amazon.com/s3
|
216
211
|
|
217
212
|
|
218
|
-
|
213
|
+
### Compilation Cache
|
219
214
|
|
220
|
-
|
221
|
-
|
222
|
-
like;y you would want it for `asset_path` tag only:
|
215
|
+
To improve build time, we have Sprockets caching enabled. You might want to
|
216
|
+
clean this cache time after time with `assets:cleanup` jekyll command:
|
223
217
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
218
|
+
$ jekyll assets:cleanup
|
219
|
+
|
220
|
+
You can turn caching off with `cache_assests` configuration option.
|
221
|
+
|
222
|
+
At the moment we use *FileStore* cache which keeps compiled data on file system.
|
223
|
+
If you need MemCache or Redis based store, please raise a ticket.
|
228
224
|
|
229
225
|
|
230
226
|
## Custom Vendors
|
@@ -454,6 +450,12 @@ assets:
|
|
454
450
|
#
|
455
451
|
cachebust: hard
|
456
452
|
#
|
453
|
+
# Whenever or not cache compiled assets (enabled by default).
|
454
|
+
# Caching significantly improves compilation performance, but you might need
|
455
|
+
# clean it up time after time with `jekyll assets:cleanup` command.
|
456
|
+
#
|
457
|
+
cache_assets: true
|
458
|
+
#
|
457
459
|
# Specifies list of MIME types that needs to have gzipped versions.
|
458
460
|
# You can set it to `false` to disable gzipping. Only javascripts and
|
459
461
|
# stylesheets are gzipped by default.
|
data/jekyll-assets.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.name = "jekyll-assets"
|
7
7
|
gem.version = Jekyll::AssetsPlugin::VERSION
|
8
8
|
gem.homepage = "http://ixti.github.com/jekyll-assets"
|
9
|
-
gem.authors = "Aleksey V Zapparov"
|
9
|
+
gem.authors = ["Aleksey V Zapparov"]
|
10
10
|
gem.email = %w{ixti@member.fsf.org}
|
11
11
|
gem.license = "MIT"
|
12
12
|
gem.summary = "jekyll-assets-#{Jekyll::AssetsPlugin::VERSION}"
|
data/lib/jekyll/assets_plugin.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# 3rd-party
|
2
|
+
require "commander"
|
3
|
+
|
4
|
+
|
5
|
+
::Commander::Runner.instance.command "assets:cleanup" do |c|
|
6
|
+
c.syntax = "jekyll assets:cleanup"
|
7
|
+
c.description = "Clenup jekyll-assets cache"
|
8
|
+
|
9
|
+
c.option "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
|
10
|
+
"Custom Jekyll configuration file"
|
11
|
+
|
12
|
+
c.action do |_, options|
|
13
|
+
assets = Jekyll::Site.new(Jekyll.configuration(options)).assets
|
14
|
+
assets.cache_path.rmtree if assets.cache_path.exist?
|
15
|
+
end
|
16
|
+
end
|
@@ -6,11 +6,12 @@ module Jekyll
|
|
6
6
|
module AssetsPlugin
|
7
7
|
class Configuration
|
8
8
|
DEFAULTS = {
|
9
|
-
:dirname
|
10
|
-
:sources
|
11
|
-
:compress
|
12
|
-
:cachebust
|
13
|
-
:
|
9
|
+
:dirname => "assets",
|
10
|
+
:sources => %w{_assets/javascripts _assets/stylesheets _assets/images},
|
11
|
+
:compress => { :css => nil, :js => nil },
|
12
|
+
:cachebust => :hard,
|
13
|
+
:cache_assets => true,
|
14
|
+
:gzip => %w{ text/css application/javascript }
|
14
15
|
}.freeze
|
15
16
|
|
16
17
|
|
@@ -45,6 +46,12 @@ module Jekyll
|
|
45
46
|
none?(@data.cachebust) ? :none : @data.cachebust.to_sym
|
46
47
|
end
|
47
48
|
|
49
|
+
|
50
|
+
def cache_assets?
|
51
|
+
!!@data.cache_assets
|
52
|
+
end
|
53
|
+
|
54
|
+
|
48
55
|
def gzip
|
49
56
|
return @data.gzip if @data.gzip.is_a? Array
|
50
57
|
@data.gzip ? DEFAULTS[:gzip] : []
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# stdlib
|
2
|
+
require "pathname"
|
3
|
+
|
4
|
+
|
1
5
|
# 3rd-party
|
2
6
|
require "sprockets"
|
3
7
|
|
@@ -27,6 +31,10 @@ module Jekyll
|
|
27
31
|
self.js_compressor = @site.assets_config.js_compressor
|
28
32
|
self.css_compressor = @site.assets_config.css_compressor
|
29
33
|
|
34
|
+
if @site.assets_config.cache_assets?
|
35
|
+
self.cache = Sprockets::Cache::FileStore.new cache_path
|
36
|
+
end
|
37
|
+
|
30
38
|
# bind jekyll and Sprockets context together
|
31
39
|
context_class.instance_variable_set :@site, @site
|
32
40
|
|
@@ -34,6 +42,11 @@ module Jekyll
|
|
34
42
|
end
|
35
43
|
|
36
44
|
|
45
|
+
def cache_path
|
46
|
+
Pathname.new(@site.source).join ".jekyll-assets-cache"
|
47
|
+
end
|
48
|
+
|
49
|
+
|
37
50
|
def find_asset path, *args
|
38
51
|
super or raise AssetNotFound, path
|
39
52
|
end
|
data/spec/fixtures/.gitignore
CHANGED
@@ -41,6 +41,11 @@ module Jekyll::AssetsPlugin
|
|
41
41
|
it { should =~ %w{ text/css application/javascript } }
|
42
42
|
end
|
43
43
|
|
44
|
+
context "cache_assets?" do
|
45
|
+
subject { config.cache_assets? }
|
46
|
+
it { should be_true }
|
47
|
+
end
|
48
|
+
|
44
49
|
end
|
45
50
|
|
46
51
|
it "should override specified options and leave defaults for missing" do
|
@@ -18,6 +18,13 @@ module Jekyll::AssetsPlugin
|
|
18
18
|
subject { site.assets }
|
19
19
|
it { should be_a_kind_of Sprockets::Environment }
|
20
20
|
|
21
|
+
context "#cache_path" do
|
22
|
+
let(:source_path) { Pathname.new site.source }
|
23
|
+
subject { site.assets.cache_path }
|
24
|
+
|
25
|
+
it { should == source_path.join(".jekyll-assets-cache") }
|
26
|
+
end
|
27
|
+
|
21
28
|
context "calling #asset_path within assets" do
|
22
29
|
context "when requested file not found" do
|
23
30
|
it "should raise a NotFound error" do
|
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: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jekyll
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- lib/jekyll-assets/neat.rb
|
182
182
|
- lib/jekyll/assets_plugin.rb
|
183
183
|
- lib/jekyll/assets_plugin/asset_file.rb
|
184
|
+
- lib/jekyll/assets_plugin/commands.rb
|
184
185
|
- lib/jekyll/assets_plugin/configuration.rb
|
185
186
|
- lib/jekyll/assets_plugin/environment.rb
|
186
187
|
- lib/jekyll/assets_plugin/filters.rb
|
@@ -242,7 +243,7 @@ rubyforge_project:
|
|
242
243
|
rubygems_version: 1.8.23
|
243
244
|
signing_key:
|
244
245
|
specification_version: 3
|
245
|
-
summary: jekyll-assets-0.5.
|
246
|
+
summary: jekyll-assets-0.5.2
|
246
247
|
test_files:
|
247
248
|
- spec/fixtures/.gitignore
|
248
249
|
- spec/fixtures/_assets/app.css.erb
|