jammit 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,16 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jammit'
3
- s.version = '0.2.0' # Keep version in sync with jammit.rb
3
+ s.version = '0.2.1' # Keep version in sync with jammit.rb
4
4
  s.date = '2009-11-18'
5
5
 
6
6
  s.homepage = "http://documentcloud.github.com/jammit/"
7
7
  s.summary = "Industrial Strength Asset Packaging for Rails"
8
8
  s.description = <<-EOS
9
9
  Jammit is an industrial strength asset packaging library for Rails,
10
- providing both the CSS and JavaScript concatenation and compression
11
- that you'd expect, as well as ahead-of-time gzipping, built-in JavaScript
12
- template support, and optional Data-URI / MHTML image embedding.
10
+ providing both the CSS and JavaScript concatenation and compression that
11
+ you'd expect, as well as YUI Compressor and Closure Compiler compatibility,
12
+ ahead-of-time gzipping, built-in JavaScript template support, and optional
13
+ Data-URI / MHTML image embedding.
13
14
  EOS
14
15
 
15
16
  s.authors = ['Jeremy Ashkenas']
@@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path(File.dirname(__FILE__))
4
4
  # to all of the configuration options.
5
5
  module Jammit
6
6
 
7
- VERSION = "0.2.0"
7
+ VERSION = "0.2.1"
8
8
 
9
9
  ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
10
10
 
@@ -40,22 +40,32 @@ module Jammit
40
40
 
41
41
  # HTML tags, in order, for all of the individual stylesheets.
42
42
  def individual_stylesheets(packages)
43
- stylesheet_link_tag(packages.map {|p| Jammit.packager.individual_urls(p.to_sym, :css) }.flatten)
43
+ tags_with_options(packages) {|p| Jammit.packager.individual_urls(p.to_sym, :css) }
44
44
  end
45
45
 
46
46
  # HTML tags for the stylesheet packages.
47
47
  def packaged_stylesheets(packages)
48
- stylesheet_link_tag(packages.map {|p| Jammit.asset_url(p, :css) })
48
+ tags_with_options(packages) {|p| Jammit.asset_url(p, :css) }
49
49
  end
50
50
 
51
51
  # HTML tags for the 'datauri', and 'mhtml' versions of the packaged
52
52
  # stylesheets, using conditional comments to load the correct variant.
53
53
  def embedded_image_stylesheets(packages)
54
- css_tags = stylesheet_link_tag(packages.map {|p| Jammit.asset_url(p, :css, :datauri) })
54
+ datauri_tags = tags_with_options(packages) {|p| Jammit.asset_url(p, :css, :datauri) }
55
55
  ie_tags = Jammit.mhtml_enabled ?
56
- stylesheet_link_tag(packages.map {|p| Jammit.asset_url(p, :css, :mhtml) }) :
57
- packaged_stylesheets(packages)
58
- [DATA_URI_START, css_tags, DATA_URI_END, MHTML_START, ie_tags, MHTML_END].join("\n")
56
+ tags_with_options(packages) {|p| Jammit.asset_url(p, :css, :mhtml) } :
57
+ packaged_stylesheets(packages)
58
+ [DATA_URI_START, datauri_tags, DATA_URI_END, MHTML_START, ie_tags, MHTML_END].join("\n")
59
+ end
60
+
61
+ # Generate the stylesheet tags for a batch of packages, with options, by
62
+ # yielding each package to a block.
63
+ def tags_with_options(packages)
64
+ packages = packages.dup
65
+ options = packages.extract_options!
66
+ packages.map! {|package| yield package }.flatten!
67
+ packages.push(options) unless options.empty?
68
+ stylesheet_link_tag(*packages)
59
69
  end
60
70
 
61
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jammit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -42,7 +42,7 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.1.0
44
44
  version:
45
- description: " Jammit is an industrial strength asset packaging library for Rails,\n providing both the CSS and JavaScript concatenation and compression\n that you'd expect, as well as ahead-of-time gzipping, built-in JavaScript\n template support, and optional Data-URI / MHTML image embedding.\n"
45
+ description: " Jammit is an industrial strength asset packaging library for Rails,\n providing both the CSS and JavaScript concatenation and compression that\n you'd expect, as well as YUI Compressor and Closure Compiler compatibility,\n ahead-of-time gzipping, built-in JavaScript template support, and optional\n Data-URI / MHTML image embedding.\n"
46
46
  email: jeremy@documentcloud.org
47
47
  executables:
48
48
  - jammit