compass-slickmap 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{compass-slickmap}
8
- s.version = "0.1.4"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thomas Reynolds"]
12
- s.date = %q{2009-08-07}
12
+ s.date = %q{2009-10-06}
13
13
  s.email = %q{tdreyno@gmail.com}
14
14
  s.files = [
15
15
  ".gitignore",
@@ -31,16 +31,17 @@ Gem::Specification.new do |s|
31
31
  "templates/project/manifest.rb",
32
32
  "templates/project/sitemap.sass"
33
33
  ]
34
+ s.has_rdoc = true
34
35
  s.homepage = %q{http://github.com/tdreyno/compass-slickmap}
35
36
  s.rdoc_options = ["--charset=UTF-8"]
36
37
  s.require_paths = ["lib"]
37
38
  s.rubyforge_project = %q{compassslickmap}
38
- s.rubygems_version = %q{1.3.5}
39
+ s.rubygems_version = %q{1.3.1}
39
40
  s.summary = %q{An implementation of SlickmapCSS sitemap in Sass}
40
41
 
41
42
  if s.respond_to? :specification_version then
42
43
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
- s.specification_version = 3
44
+ s.specification_version = 2
44
45
 
45
46
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
47
  s.add_runtime_dependency(%q<chriseppstein-compass>, [">= 0"])
data/lib/slickmap.rb CHANGED
@@ -1 +1,45 @@
1
- require File.join(File.dirname(__FILE__), 'slickmap', 'compass_plugin')
1
+ require 'base64'
2
+ require File.join(File.dirname(__FILE__), 'slickmap', 'compass_plugin')
3
+
4
+ module Compass::SlickmapImage
5
+ def slickmap_image(path, mime_type = nil)
6
+ path = path.value
7
+ real_path = File.join(File.dirname(__FILE__), "..", "templates", "project", "images", path)
8
+ url = "url('data:#{compute_mime_type(path,mime_type)};base64,#{data(real_path)}')"
9
+ Sass::Script::String.new(url)
10
+ end
11
+
12
+ private
13
+ def compute_mime_type(path, mime_type)
14
+ return mime_type if mime_type
15
+ case path
16
+ when /\.png$/i
17
+ 'image/png'
18
+ when /\.jpe?g$/i
19
+ 'image/jpeg'
20
+ when /\.gif$/i
21
+ 'image/gif'
22
+ when /\.([a-zA-Z]+)$/
23
+ "image/#{Regexp.last_match(1).downcase}"
24
+ else
25
+ raise Compass::Error, "A mime type could not be determined for #{path}, please specify one explicitly."
26
+ end
27
+ end
28
+
29
+ def data(real_path)
30
+ if File.readable?(real_path)
31
+ Base64.encode64(File.read(real_path)).gsub("\n","")
32
+ else
33
+ raise Compass::Error, "File not found or cannot be read: #{real_path}"
34
+ end
35
+ end
36
+ end
37
+
38
+
39
+ module ::Sass::Script::Functions
40
+ include Compass::SlickmapImage
41
+ end
42
+
43
+ class ::Sass::Script::Functions::EvaluationContext
44
+ include ::Sass::Script::Functions
45
+ end
@@ -2,4 +2,4 @@ options = Hash.new
2
2
  options[:stylesheets_directory] = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'sass'))
3
3
  options[:templates_directory] = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'templates'))
4
4
 
5
- Compass::Frameworks.register('slickmap', options)
5
+ Compass::Frameworks.register('slickmap', options)
data/sass/_slickmap.sass CHANGED
@@ -1,5 +1,4 @@
1
1
  @import compass/utilities/general/reset.sass
2
- !slickmap_image_prefix ||= ""
3
2
 
4
3
  =slickmap(!body_selector = "body")
5
4
  +global-reset
@@ -49,7 +48,7 @@
49
48
  clear: left
50
49
  margin-top: 0
51
50
  padding: 10px 0 0 0
52
- background= image_url("#{!slickmap_image_prefix}vertical-line.png") "center" "bottom" "repeat-y"
51
+ background= slickmap_image("vertical-line.png") "center" "bottom" "repeat-y"
53
52
  a
54
53
  background-color: #cee3ac
55
54
  border-color: #b8da83
@@ -59,7 +58,7 @@
59
58
  &:first-child
60
59
  padding-top: 30px
61
60
  &:last-child
62
- background= image_url("#{!slickmap_image_prefix}vertical-line.png") "center" "bottom" "repeat-y"
61
+ background= slickmap_image("vertical-line.png") "center" "bottom" "repeat-y"
63
62
 
64
63
  a:link:before, a:visited:before
65
64
  color: #8faf5c
@@ -70,10 +69,10 @@
70
69
  width: 100%
71
70
  float: right
72
71
  padding: 9px 0 10px 0
73
- background= #fff image_url("#{!slickmap_image_prefix}L3-ul-top.png") "center" "top" "no-repeat"
72
+ background= #fff slickmap_image("L3-ul-top.png") "center" "top" "no-repeat"
74
73
 
75
74
  li
76
- background= image_url("#{!slickmap_image_prefix}L3-center.png") "left" "center" "no-repeat"
75
+ background= slickmap_image("L3-center.png") "left" "center" "no-repeat"
77
76
  padding: 5px 0
78
77
  a
79
78
  background-color: #fff7aa
@@ -87,20 +86,20 @@
87
86
  border-color: #d1b62c
88
87
  &:first-child
89
88
  padding: 15px 0 5px 0
90
- background= image_url("#{!slickmap_image_prefix}L3-li-top.png") "left" "center" "no-repeat"
89
+ background= slickmap_image("L3-li-top.png") "left" "center" "no-repeat"
91
90
  &:last-child
92
- background= image_url("#{!slickmap_image_prefix}L3-bottom.png") "left" "center" "no-repeat"
91
+ background= slickmap_image("L3-bottom.png") "left" "center" "no-repeat"
93
92
  a:link:before, a:visited:before
94
93
  color: #ccae14
95
94
  font-size: 9px
96
95
 
97
96
  li
98
97
  float: left
99
- background= image_url("#{!slickmap_image_prefix}L1-center.png") "center" "top" "no-repeat"
98
+ background= slickmap_image("L1-center.png") "center" "top" "no-repeat"
100
99
  padding: 30px 0
101
100
  margin-top: -30px
102
101
  &:last-child
103
- background= image_url("#{!slickmap_image_prefix}L1-right.png") "center" "top" "no-repeat"
102
+ background= slickmap_image("L1-right.png") "center" "top" "no-repeat"
104
103
  a
105
104
  margin: 0 20px 0 0
106
105
  padding: 10px 0
@@ -109,7 +108,7 @@
109
108
  font-weight: bold
110
109
  text-align: center
111
110
  color: black
112
- background= #c3eafb image_url("#{!slickmap_image_prefix}white-highlight.png") "top" "left" "repeat-x"
111
+ background= #c3eafb slickmap_image("white-highlight.png") "top" "left" "repeat-x"
113
112
  border: 2px solid #b5d9ea
114
113
  -moz-border-radius: 5px
115
114
  -webkit-border-radius: 5px
@@ -122,7 +121,7 @@
122
121
  =slickmap-primary-nav-home
123
122
  display: block
124
123
  float: none
125
- background= #fff image_url("#{!slickmap_image_prefix}L1-left.png") "center" "bottom" "no-repeat"
124
+ background= #fff slickmap_image("L1-left.png") "center" "bottom" "no-repeat"
126
125
  position: relative
127
126
  z-index: 2
128
127
  padding: 0 0 30px 0
@@ -143,7 +142,7 @@
143
142
  font-weight: bold
144
143
  text-align: center
145
144
  color: black
146
- background= #fff7aa image_url("#{!slickmap_image_prefix}white-highlight.png") "top" "left" "repeat-x"
145
+ background= #fff7aa slickmap_image("white-highlight.png") "top" "left" "repeat-x"
147
146
  -moz-border-radius: 5px
148
147
  -webkit-border-radius: 5px
149
148
  -webkit-box-shadow: rgba(0,0,0,0.5) 2px 2px 2px
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-slickmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-07 00:00:00 -07:00
12
+ date: 2009-10-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -51,8 +51,6 @@ files:
51
51
  - templates/project/sitemap.sass
52
52
  has_rdoc: true
53
53
  homepage: http://github.com/tdreyno/compass-slickmap
54
- licenses: []
55
-
56
54
  post_install_message:
57
55
  rdoc_options:
58
56
  - --charset=UTF-8
@@ -73,9 +71,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
71
  requirements: []
74
72
 
75
73
  rubyforge_project: compassslickmap
76
- rubygems_version: 1.3.5
74
+ rubygems_version: 1.3.1
77
75
  signing_key:
78
- specification_version: 3
76
+ specification_version: 2
79
77
  summary: An implementation of SlickmapCSS sitemap in Sass
80
78
  test_files: []
81
79