sprite-factory-custom 1.6.3 → 1.6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50fe0c04fb190de103e2dcd862e742aba151ea05
4
- data.tar.gz: f4053f53473d9118886e1166b94cf4b270bbdfca
3
+ metadata.gz: 4a42eab2aa620a1afc021ee985aeb85d1e1850cf
4
+ data.tar.gz: 7cb579feff9af1c37d6b5aa00f8c79d4b6d633da
5
5
  SHA512:
6
- metadata.gz: dbfe61e27715481189ad51bc1358231c21d88036e51946aab49bae6108ed8c7274a23cae41bd43bfab7b58bc908c33c21e2eb86059ac61fdeebf7a65ffd7e60d
7
- data.tar.gz: 27f0ee4b07b87bbc771d7e1607689148729a464159dc8841db457572b27050dead963cd9a8130baec0c33f6a78457e00ccb2c77924f2379623beb27a5b31d863
6
+ metadata.gz: 45bb5dce76022a25d45c385767bc9a3b96b4ac201eb47bee8d35e6b31b2c319a85d50633a11fd4cb9854f6b0a7fcf782d90c45e2800074954a75082a16c99387
7
+ data.tar.gz: 499e3ed275775a16fe1c90e21696c909ea28dda7149384ec0d30b7cb15bf48b35c30938c2370ac2f8ac82e515ecef1894f168d5663ff6e98483d9867c54df7ae
data/bin/sf CHANGED
@@ -32,6 +32,7 @@ margin_help = "add margin to each sprite"
32
32
  nocomments_help = "suppress comments in generated stylesheet"
33
33
  custom_styles_help = "Add custom styles for each sprites (E.g.: --custom-styles='display: inline-block;'"
34
34
  retina_help = "create 50% smaller images & css as well"
35
+ media_query_help = "wrap generated css with media query css selector"
35
36
 
36
37
  op.on("--layout [ORIENTATION]", layout_help) {|value| options[:layout] = value }
37
38
  op.on("--style [STYLE]", style_help) {|value| options[:style] = value }
@@ -46,6 +47,7 @@ op.on("--padding [PIXELS]", padding_help) {|value| options[:paddi
46
47
  op.on("--margin [PIXELS]", margin_help) {|value| options[:margin] = value.to_i }
47
48
  op.on("--nocomments", nocomments_help) {|value| options[:nocomments] = true }
48
49
  op.on("--retina", retina_help) {|value| options[:retina] = true }
50
+ op.on("--media_query", media_query_help) {|value| options[:media_query] = true }
49
51
 
50
52
  begin
51
53
  op.parse!(ARGV)
@@ -12,7 +12,7 @@ module SpriteFactory
12
12
 
13
13
  attr :input
14
14
  attr :config
15
-
15
+
16
16
  def initialize(input, config = {})
17
17
  @input = input.to_s[-1] == "/" ? input[0...-1] : input # gracefully ignore trailing slash on input directory name
18
18
  @config = config
@@ -25,7 +25,7 @@ module SpriteFactory
25
25
  @config[:pngcrush] ||= SpriteFactory.pngcrush
26
26
  @config[:nocomments] ||= SpriteFactory.nocomments
27
27
  end
28
-
28
+
29
29
  #----------------------------------------------------------------------------
30
30
 
31
31
  def run!(&block)
@@ -55,9 +55,9 @@ module SpriteFactory
55
55
 
56
56
  css = []
57
57
  css << style_comment(header) unless nocomments? # header comment
58
- css << retina_wrapper_start() if retina? # if retina images
58
+ css << retina_wrapper_start() if retina? && media_query? # if retina images
59
59
  css << style(selector, css_url, images, max, &block) # generated styles
60
- css << retina_wrapper_end() if retina? # if retina images
60
+ css << retina_wrapper_end() if retina? && media_query? # if retina images
61
61
  css << IO.read(custom_style_file) if File.exists?(custom_style_file) # custom styles
62
62
  css = css.join("\n")
63
63
 
@@ -80,9 +80,13 @@ module SpriteFactory
80
80
  end
81
81
 
82
82
  #----------------------------------------------------------------------------
83
-
83
+
84
84
  private
85
85
 
86
+ def media_query?
87
+ config[:media_query]
88
+ end
89
+
86
90
  def retina?
87
91
  config[:retina]
88
92
  end
@@ -264,7 +268,7 @@ module SpriteFactory
264
268
  if SUPPORTS_PNGCRUSH && config[:pngcrush]
265
269
  crushed = "#{image}.crushed"
266
270
  `pngcrush -rem alla -reduce -brute #{image} #{crushed}`
267
- FileUtils.mv(crushed, image)
271
+ FileUtils.mv(crushed, image)
268
272
  end
269
273
  end
270
274
 
@@ -60,7 +60,6 @@ only screen and (min-device-pixel-ratio: 1.5) {"
60
60
  styles = []
61
61
  divider = config[:retina] ? 2 : 1
62
62
  images.each do |image|
63
- puts "DIV #{divider}"
64
63
  attr = [
65
64
  "width: #{image[:cssw] / divider}px",
66
65
  "height: #{image[:cssh] / divider}px",
@@ -2,7 +2,7 @@ module SpriteFactory
2
2
 
3
3
  #----------------------------------------------------------------------------
4
4
 
5
- VERSION = "1.6.3"
5
+ VERSION = "1.6.4.1"
6
6
  SUMMARY = "Automatic CSS sprite generator"
7
7
  DESCRIPTION = "[tam-vo/sprite-factory v#{VERSION}] Combines individual images from a directory into a single sprite image file and creates an appropriate CSS stylesheet"
8
8
  LIB = File.dirname(__FILE__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprite-factory-custom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Gordon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-20 00:00:00.000000000 Z
12
+ date: 2014-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
@@ -39,7 +39,7 @@ dependencies:
39
39
  - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
- description: '[tam-vo/sprite-factory v1.6.3] Combines individual images from a directory
42
+ description: '[tam-vo/sprite-factory v1.6.4.1] Combines individual images from a directory
43
43
  into a single sprite image file and creates an appropriate CSS stylesheet'
44
44
  email:
45
45
  - jake@codeincomplete.com