jekyll-assets 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.3.5 (2013-03-03)
2
+
3
+ * Add buil-tim neat support as `require "jekyll-assets/neat"`. See #18.
4
+ (Thanks @awmichel)
5
+ * Automagically produce GZipped assets. See #17. (Thanks @beanieboi)
6
+
7
+
1
8
  ### 0.3.4 (2013-02-18)
2
9
 
3
10
  * Fix assets regeneration (with --auto) issue. See #13.
data/README.md CHANGED
@@ -15,13 +15,17 @@ Jekyll plugin, that adds Rails-alike assets pipeline, that means that:
15
15
  - It supports JavaScript templates for client-side rendering of strings or
16
16
  markup. JavaScript templates have the special format extension `.jst` and are
17
17
  compiled to JavaScript functions.
18
- - Automaticaly adds MD5 fingerprint suffix for _cache busting_. That means
19
- that your `app.css` will become `app-908e25f4bf641868d8683022a5b62f54.css`.
20
- - [Compass][compass] and [Bourbon][bourbon] built-in support.
18
+ - Adds MD5 fingerprint suffix for _cache busting_. That means your `app.css`
19
+ will become `app-908e25f4bf641868d8683022a5b62f54.css`. See `cachebust`
20
+ configuration option for other variants.
21
+ - Produce gzipped versions of assets. See `gzip` configuration option for
22
+ details.
23
+ - [Compass][compass], [Bourbon][bourbon] and [Neat][neat] built-in support.
21
24
  See "Custom Vendors" below.
22
25
 
23
26
  [compass]: http://compass-style.org/
24
27
  [bourbon]: http://bourbon.io/
28
+ [neat]: http://neat.bourbon.io/
25
29
 
26
30
  Jekyll-Assets uses fabulous [Sprockets][sprockets] under the hood, so you may
27
31
  refer to Rails guide about [Asset Pipeline][rails-guide] for detailed
@@ -282,6 +286,18 @@ require "jekyll-assets/bourbon"
282
286
  Now you can add `@import "bourbon"` in your SASS assets to get Bourbon goodies.
283
287
 
284
288
 
289
+ #### Neat Support
290
+
291
+ Require `jekyll-assets/neat` to enable, e.g.:
292
+
293
+ ``` ruby
294
+ require "jekyll-assets"
295
+ require "jekyll-assets/neat"
296
+ ```
297
+
298
+ Now you can add `@import "neat"` in your SASS assets to get Neat goodies.
299
+
300
+
285
301
  ## The Directive Processor
286
302
 
287
303
  *Note:* This section extracted from [Sprockets][sprockets] README.
@@ -435,18 +451,15 @@ assets:
435
451
  # output URL: /assets/javascripts/app-4f41243847da693a4f356c0486114bc6.css
436
452
  #
437
453
  cachebust: hard
454
+ #
455
+ # Specifies list of MIME types that needs to have gzipped versions.
456
+ # You can set it to `false` to disable gzipping. Only javascripts and
457
+ # stylesheets are gzipped by default.
458
+ #
459
+ gzip: [ text/css, application/javascript ]
438
460
  ```
439
461
 
440
462
 
441
- ## Contributing
442
-
443
- 1. Fork it
444
- 2. Create your feature branch (`git checkout -b my-new-feature`)
445
- 3. Commit your changes (`git commit -am 'Added some feature'`)
446
- 4. Push to the branch (`git push origin my-new-feature`)
447
- 5. Create new Pull Request
448
-
449
-
450
463
  ## "Th-th-th-that's all folks!"
451
464
 
452
465
  Feel free to follow me on [twitter][twitter], chat via [jabber][jabber] or
@@ -457,6 +470,15 @@ write an [e-mail][e-mail]. :D
457
470
  [e-mail]: mailto://ixti@member.fsf.org
458
471
 
459
472
 
473
+ ## Contributing
474
+
475
+ 1. Fork it
476
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
477
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
478
+ 4. Push to the branch (`git push origin my-new-feature`)
479
+ 5. Create new Pull Request
480
+
481
+
460
482
  ## License
461
483
 
462
484
  Copyright (C) 2012 Aleksey V Zapparov (http://ixti.net/)
@@ -8,6 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.homepage = "http://ixti.github.com/jekyll-assets"
9
9
  gem.authors = "Aleksey V Zapparov"
10
10
  gem.email = %w{ixti@member.fsf.org}
11
+ gem.license = "MIT"
11
12
  gem.summary = "jekyll-assets-#{Jekyll::AssetsPlugin::VERSION}"
12
13
  gem.description = <<-DESC
13
14
  Jekyll plugin, that allows you to write javascript/css assets in
@@ -16,7 +17,7 @@ Gem::Specification.new do |gem|
16
17
  DESC
17
18
 
18
19
  gem.add_dependency "jekyll"
19
- gem.add_dependency "sprockets", "~> 2.8"
20
+ gem.add_dependency "sprockets", "~> 2.9"
20
21
 
21
22
  gem.add_development_dependency "rake"
22
23
  gem.add_development_dependency "rspec"
@@ -24,6 +25,7 @@ Gem::Specification.new do |gem|
24
25
  gem.add_development_dependency "rb-inotify"
25
26
  gem.add_development_dependency "compass"
26
27
  gem.add_development_dependency "bourbon"
28
+ gem.add_development_dependency "neat"
27
29
 
28
30
  gem.files = `git ls-files`.split($\)
29
31
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -0,0 +1,5 @@
1
+ require "sprockets"
2
+
3
+
4
+ neat_root = Gem::Specification.find_by_name("neat").gem_dir
5
+ Sprockets.append_path File.join(neat_root, "app", "assets", "stylesheets")
@@ -1,30 +1,39 @@
1
+ # stdlib
2
+ require "forwardable"
3
+
4
+
1
5
  module Jekyll
2
6
  module AssetsPlugin
3
7
  class AssetFile
4
8
 
9
+ extend Forwardable
10
+
11
+
5
12
  @@mtimes = Hash.new
6
13
 
7
14
 
8
15
  attr_reader :asset
9
16
 
10
17
 
18
+ def_delegator :@site, :assets_config, :config
19
+ def_delegator :@asset, :content_type
20
+
21
+
11
22
  def initialize site, asset
12
23
  @site, @asset = site, asset
13
24
  end
14
25
 
15
26
 
16
27
  def destination dest
17
- File.join dest, @site.assets_config.dirname, filename
28
+ File.join dest, config.dirname, filename
18
29
  end
19
30
 
20
31
 
21
32
  def filename
22
- cachebust = @site.assets_config.cachebust
23
-
24
- case cachebust
33
+ case config.cachebust
25
34
  when :none, :soft then asset.logical_path
26
35
  when :hard then asset.digest_path
27
- else raise "Unknown cachebust strategy: #{cachebust.inspect}"
36
+ else raise "Unknown cachebust strategy: #{config.cachebust.inspect}"
28
37
  end
29
38
  end
30
39
 
@@ -51,6 +60,8 @@ module Jekyll
51
60
  @@mtimes[path] = mtime
52
61
 
53
62
  @asset.write_to dest_path
63
+ @asset.write_to "#{dest_path}.gz" if gzip?
64
+
54
65
  true
55
66
  end
56
67
 
@@ -64,6 +75,11 @@ module Jekyll
64
75
  end
65
76
 
66
77
 
78
+ def gzip?
79
+ config.gzip && config.gzip.include?(content_type)
80
+ end
81
+
82
+
67
83
  def to_s
68
84
  "#<Jekyll::AssetsPlugin::AssetFile:#{asset.logical_path}>"
69
85
  end
@@ -9,7 +9,8 @@ module Jekyll
9
9
  :dirname => "assets",
10
10
  :sources => %w{_assets/javascripts _assets/stylesheets _assets/images},
11
11
  :compress => { :css => nil, :js => nil },
12
- :cachebust => :hard
12
+ :cachebust => :hard,
13
+ :gzip => %w{ text/css application/javascript }
13
14
  }.freeze
14
15
 
15
16
 
@@ -44,6 +45,11 @@ module Jekyll
44
45
  none?(@data.cachebust) ? :none : @data.cachebust.to_sym
45
46
  end
46
47
 
48
+ def gzip
49
+ return @data.gzip if @data.gzip.is_a? Array
50
+ @data.gzip ? DEFAULTS[:gzip] : false
51
+ end
52
+
47
53
 
48
54
  def method_missing name, *args, &block
49
55
  @data.send name, *args, &block
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AssetsPlugin
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.5"
4
4
  end
5
5
  end
@@ -0,0 +1,5 @@
1
+ @import "bourbon"
2
+ @import "neat"
3
+
4
+ .container
5
+ @include outer-container
@@ -0,0 +1,11 @@
1
+ require "spec_helper"
2
+ require "jekyll-assets/neat"
3
+
4
+
5
+ module Jekyll::AssetsPlugin
6
+ describe "Neat integration" do
7
+ it "should globally append neat paths into Sprockets environment" do
8
+ @site.assets["vendor/neat.css"].to_s.should =~ /max-width/
9
+ end
10
+ end
11
+ end
@@ -35,6 +35,12 @@ module Jekyll::AssetsPlugin
35
35
  subject { config.compress.css }
36
36
  it { should be_nil }
37
37
  end
38
+
39
+ context "gzip" do
40
+ subject { config.gzip }
41
+ it { should =~ %w{ text/css application/javascript } }
42
+ end
43
+
38
44
  end
39
45
 
40
46
  it "should override specified options and leave defaults for missing" do
@@ -91,5 +97,13 @@ module Jekyll::AssetsPlugin
91
97
  it { should be_false }
92
98
  end
93
99
  end
100
+
101
+ context "#gzip" do
102
+ context "when gzip is disabled" do
103
+ let(:config){ Configuration.new(:gzip => false) }
104
+ subject { config.gzip }
105
+ it { should be false }
106
+ end
107
+ end
94
108
  end
95
109
  end
@@ -107,6 +107,22 @@ module Jekyll::AssetsPlugin
107
107
  @dest.join("assets", "app.css").exist?.should be_true
108
108
  end
109
109
 
110
+ context "#gzip" do
111
+ subject { site.assets_config }
112
+
113
+ it "should generate a static assets if gzip is enabled" do
114
+ @site.assets_config.gzip = true
115
+ @site.process
116
+ @dest.join("assets", "app.css.gz").exist?.should be_true
117
+ end
118
+
119
+ it "should not generate a static assets if gzip is enabled" do
120
+ @site.assets_config.gzip = false
121
+ @site.process
122
+ @dest.join("assets", "app.css.gz").exist?.should be_false
123
+ end
124
+
125
+ end
110
126
 
111
127
  it "should be included into Jekyll::Site" do
112
128
  Jekyll::Site.included_modules.should include SitePatch
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.3.4
4
+ version: 0.3.5
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-02-18 00:00:00.000000000 Z
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jekyll
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '2.8'
37
+ version: '2.9'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '2.8'
45
+ version: '2.9'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rake
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +139,22 @@ dependencies:
139
139
  - - ! '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: neat
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
142
158
  description: ! " Jekyll plugin, that allows you to write javascript/css assets in\n
143
159
  \ other languages such as CoffeeScript, Sass, Less and ERB, concatenate\n them,
144
160
  respecting dependencies, minify and many more.\n"
@@ -162,6 +178,7 @@ files:
162
178
  - lib/jekyll-assets.rb
163
179
  - lib/jekyll-assets/bourbon.rb
164
180
  - lib/jekyll-assets/compass.rb
181
+ - lib/jekyll-assets/neat.rb
165
182
  - lib/jekyll/assets_plugin.rb
166
183
  - lib/jekyll/assets_plugin/asset_file.rb
167
184
  - lib/jekyll/assets_plugin/configuration.rb
@@ -183,12 +200,14 @@ files:
183
200
  - spec/fixtures/_assets/vapor.js
184
201
  - spec/fixtures/_assets/vendor/bourbon.css.sass
185
202
  - spec/fixtures/_assets/vendor/compass.css.sass
203
+ - spec/fixtures/_assets/vendor/neat.css.sass
186
204
  - spec/fixtures/_config.yml
187
205
  - spec/fixtures/_layouts/default.html
188
206
  - spec/fixtures/_posts/2012-10-19-hello-world.md
189
207
  - spec/fixtures/index.html
190
208
  - spec/lib/jekyll-assets/bourbon_spec.rb
191
209
  - spec/lib/jekyll-assets/compass_spec.rb
210
+ - spec/lib/jekyll-assets/neat_spec.rb
192
211
  - spec/lib/jekyll/assets_plugin/asset_file_spec.rb
193
212
  - spec/lib/jekyll/assets_plugin/configuration_spec.rb
194
213
  - spec/lib/jekyll/assets_plugin/filters_spec.rb
@@ -197,7 +216,8 @@ files:
197
216
  - spec/spec_helper.rb
198
217
  - spec/support/fixtures_path.rb
199
218
  homepage: http://ixti.github.com/jekyll-assets
200
- licenses: []
219
+ licenses:
220
+ - MIT
201
221
  post_install_message:
202
222
  rdoc_options: []
203
223
  require_paths:
@@ -208,18 +228,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
228
  - - ! '>='
209
229
  - !ruby/object:Gem::Version
210
230
  version: '0'
231
+ segments:
232
+ - 0
233
+ hash: -3616688251786802351
211
234
  required_rubygems_version: !ruby/object:Gem::Requirement
212
235
  none: false
213
236
  requirements:
214
237
  - - ! '>='
215
238
  - !ruby/object:Gem::Version
216
239
  version: '0'
240
+ segments:
241
+ - 0
242
+ hash: -3616688251786802351
217
243
  requirements: []
218
244
  rubyforge_project:
219
245
  rubygems_version: 1.8.23
220
246
  signing_key:
221
247
  specification_version: 3
222
- summary: jekyll-assets-0.3.4
248
+ summary: jekyll-assets-0.3.5
223
249
  test_files:
224
250
  - spec/fixtures/.gitignore
225
251
  - spec/fixtures/_assets/app.css.erb
@@ -230,12 +256,14 @@ test_files:
230
256
  - spec/fixtures/_assets/vapor.js
231
257
  - spec/fixtures/_assets/vendor/bourbon.css.sass
232
258
  - spec/fixtures/_assets/vendor/compass.css.sass
259
+ - spec/fixtures/_assets/vendor/neat.css.sass
233
260
  - spec/fixtures/_config.yml
234
261
  - spec/fixtures/_layouts/default.html
235
262
  - spec/fixtures/_posts/2012-10-19-hello-world.md
236
263
  - spec/fixtures/index.html
237
264
  - spec/lib/jekyll-assets/bourbon_spec.rb
238
265
  - spec/lib/jekyll-assets/compass_spec.rb
266
+ - spec/lib/jekyll-assets/neat_spec.rb
239
267
  - spec/lib/jekyll/assets_plugin/asset_file_spec.rb
240
268
  - spec/lib/jekyll/assets_plugin/configuration_spec.rb
241
269
  - spec/lib/jekyll/assets_plugin/filters_spec.rb
@@ -243,4 +271,3 @@ test_files:
243
271
  - spec/lib/jekyll/assets_plugin/tag_spec.rb
244
272
  - spec/spec_helper.rb
245
273
  - spec/support/fixtures_path.rb
246
- has_rdoc: