rails-sprite 0.0.3 → 0.0.4

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: 3f1f161c45ab42b30f3a2e3829b970a723262f36
4
- data.tar.gz: b6307cc28ffbe84024c89ebba851ed185f07adae
3
+ metadata.gz: 81291115be7ec430a5000cdde3d17c1f2b6ffb6f
4
+ data.tar.gz: 0eeec1854a98518edfa05f08a493f13ee6f64964
5
5
  SHA512:
6
- metadata.gz: e8200de91069f1ab0cde28a42b78ff9b72dcbdc80eb37f90762159a6eaa9f18043b444a034a026f8b90ac739f15b86222a61bd9a7c59fe19b0b82b0147765588
7
- data.tar.gz: e3d1c749166df140684c4ea063b3dde270fbd061ba2f9108f8a300f8b66ad16ec701f489afce9ed868684bf61769cbc03a2b970acdfdc468a941357ebc58b0ec
6
+ metadata.gz: ea498c75f7dc6315e83df0c25a3ff940274044e49c6a211e6ef9a1c765736c48f77e9eedb065a3b3b7c8967f20573ff28398defecac771b133ce742a1460c608
7
+ data.tar.gz: 189134668d4ea09035b2171b584e368f8fbac4947b70d4d5fb4cb74aab45afcb87adec0087ec19864cfb8d954613e94f43bbea043cfe7eb86aebb3da41b623ed
data/README.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # RailsSprite
2
2
 
3
3
  ```
4
+ usage:
5
+
6
+ add to your Gemfile
7
+
8
+ gem 'rails-sprite'
9
+
10
+ bundle install
11
+
4
12
  eg.
5
13
 
6
14
  image source folder:
@@ -1,4 +1,4 @@
1
- require 'RMagick'
1
+ require 'rmagick'
2
2
 
3
3
  module RailsSprite
4
4
  module Library
@@ -30,15 +30,16 @@ module RailsSprite
30
30
  result[:image_scope_name] = image_scope_name
31
31
  result[:css_class_shared] = css_class_shared
32
32
 
33
- # case css_extend
34
- # when '.css.scss.erb'
35
- # else
36
- # end
33
+ css_filt_content = case css_extend
34
+ when '.css.scss.erb', '.scss.erb'
35
+ composite_css_scss_erb(result)
36
+ else
37
+ end
37
38
 
38
39
  system "mkdir -p #{::File.dirname(stylesheet_to)}"
39
40
 
40
41
  ::File.open(stylesheet_to, 'w') do |file|
41
- file.write( composite_css_scss_erb(result) )
42
+ file.write( css_filt_content )
42
43
  end
43
44
 
44
45
  result
@@ -47,48 +48,28 @@ module RailsSprite
47
48
  def self.composite_css_scss_erb result
48
49
  styles = []
49
50
 
51
+ styles << <<-END_CSS
52
+ .#{result[:css_class_shared]} {
53
+ background-image: url(<%= image_path("#{result[:image_scope_name]}") %>);
54
+ background-repeat: no-repeat;
55
+ }
56
+ END_CSS
57
+
50
58
  result[:styles].each do |style|
51
59
  styles << <<-END_CSS
52
60
  .#{style[:class]} {
53
- background: url(<%= image_path("#{result[:image_scope_name]}") %>) #{style[:x]} -#{style[:y]} no-repeat;
61
+ background-position: #{style[:x]} -#{style[:y]};
54
62
  }
55
63
  END_CSS
56
- end
57
-
58
64
 
59
- # styles << <<-END_CSS
60
- # .#{result[:css_class_shared]} {
61
- # background: url(<%= image_path("#{result[:image_scope_name]}") %>) no-repeat;
62
- # }
63
- # END_CSS
64
-
65
- # result[:styles].each do |style|
66
- # styles << <<-END_CSS
67
- #.#{style[:class]} {
68
- # background-position: #{style[:x]} -#{style[:y]};
69
- #}
70
- # END_CSS
71
- # end
72
65
 
66
+ # .#{style[:class]} {
67
+ # background: url(<%= image_path("#{result[:image_scope_name]}") %>) #{style[:x]} -#{style[:y]} no-repeat;
68
+ # }
69
+ end
73
70
 
74
71
  styles.join("\n")
75
72
  end
76
73
 
77
- # def self.generate(style_name, selector, url, images)
78
- # styles = []
79
- # images.each do |image|
80
- # attr = [
81
- # "width: #{image[:cssw]}px",
82
- # "height: #{image[:cssh]}px",
83
- # "background: #{url} #{-image[:cssx]}px #{-image[:cssy]}px no-repeat"
84
- # ]
85
- # image[:selector] = selector # make selector available for (optional) custom rule generators
86
- # image[:style] = send("#{style_name}_style", attr) # make pure style available for (optional) custom rule generators (see usage of yield inside Runner#style)
87
- # styles << send(style_name, selector, image[:name], attr)
88
- # end
89
- # styles << ""
90
- # styles.join("\n")
91
- # end
92
-
93
74
  end
94
75
  end
@@ -1,3 +1,3 @@
1
1
  module RailsSprite
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-sprite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - happy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails