compass-edge 0.9.4 → 0.9.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. data/CHANGELOG.markdown +32 -2
  2. data/README.markdown +12 -2
  3. data/REVISION +1 -1
  4. data/Rakefile +3 -1
  5. data/VERSION.yml +1 -2
  6. data/examples/blueprint_default/index.html.haml +3 -3
  7. data/examples/blueprint_default/parts/forms.html.haml +2 -0
  8. data/examples/blueprint_default/src/screen.sass +1 -1
  9. data/examples/blueprint_plugins/index.html.haml +6 -6
  10. data/examples/blueprint_plugins/src/buttons.sass +2 -2
  11. data/examples/blueprint_plugins/src/link_icons.sass +1 -1
  12. data/examples/blueprint_plugins/src/rtl_screen.sass +3 -3
  13. data/examples/blueprint_plugins/src/screen.sass +2 -2
  14. data/examples/blueprint_semantic/src/liquid.sass +4 -4
  15. data/examples/blueprint_semantic/src/screen.sass +3 -3
  16. data/examples/compass/bootstrap.rb +3 -0
  17. data/examples/compass/extensions/yui/stylesheets/_yui.sass +7 -0
  18. data/examples/compass/extensions/yui/stylesheets/yui/modules/_base.sass +70 -0
  19. data/examples/compass/extensions/yui/stylesheets/yui/modules/_fonts.sass +45 -0
  20. data/examples/compass/extensions/yui/stylesheets/yui/modules/_grids.sass +385 -0
  21. data/examples/compass/extensions/yui/stylesheets/yui/modules/_reset.sass +61 -0
  22. data/examples/compass/extensions/yui/templates/project/manifest.rb +1 -0
  23. data/examples/compass/extensions/yui/templates/project/screen.sass +4 -0
  24. data/examples/compass/src/utilities.sass +2 -2
  25. data/examples/css3/config.rb +6 -0
  26. data/examples/css3/extensions/fancy-fonts/templates/project/Vtks Revolt.ttf +0 -0
  27. data/examples/css3/extensions/fancy-fonts/templates/project/angelina.ttf +0 -0
  28. data/examples/css3/extensions/fancy-fonts/templates/project/fancy-fonts.sass +7 -0
  29. data/examples/css3/extensions/fancy-fonts/templates/project/manifest.rb +5 -0
  30. data/examples/css3/images/fresh-peas.jpg +0 -0
  31. data/examples/css3/index.html.haml +55 -0
  32. data/examples/css3/src/_base.sass +14 -0
  33. data/examples/css3/src/fancy-fonts.sass +7 -0
  34. data/examples/css3/src/gradient.sass +10 -0
  35. data/examples/css3/src/main.sass +80 -0
  36. data/examples/css3/stylesheets/fonts/Vtks Revolt.ttf +0 -0
  37. data/examples/css3/stylesheets/fonts/angelina.ttf +0 -0
  38. data/examples/downloader.rb +2 -2
  39. data/examples/ninesixty/extensions/ninesixty/README.mkdn +56 -0
  40. data/examples/ninesixty/extensions/ninesixty/compass-960-plugin.gemspec +36 -0
  41. data/examples/ninesixty/extensions/ninesixty/lib/ninesixty.rb +1 -0
  42. data/examples/ninesixty/extensions/ninesixty/lib/ninesixty/compass_plugin.rb +5 -0
  43. data/examples/ninesixty/extensions/ninesixty/sass/960/_grid.sass +64 -0
  44. data/examples/ninesixty/extensions/ninesixty/sass/960/_text.sass +59 -0
  45. data/examples/ninesixty/extensions/ninesixty/templates/project/grid.sass +34 -0
  46. data/examples/ninesixty/extensions/ninesixty/templates/project/manifest.rb +2 -0
  47. data/examples/ninesixty/extensions/ninesixty/templates/project/text.sass +10 -0
  48. data/examples/susy/bootstrap.rb +3 -0
  49. data/examples/susy/config.rb +9 -0
  50. data/examples/susy/extensions/susy/LICENSE.txt +28 -0
  51. data/examples/susy/extensions/susy/README.mkdn +235 -0
  52. data/examples/susy/extensions/susy/compass-susy-plugin.gemspec +35 -0
  53. data/examples/susy/extensions/susy/docs/tutorial/build.sh +141 -0
  54. data/examples/susy/extensions/susy/docs/tutorial/code/01_target/src/_defaults.sass +100 -0
  55. data/examples/susy/extensions/susy/docs/tutorial/code/01_target/src/screen.sass +98 -0
  56. data/examples/susy/extensions/susy/docs/tutorial/code/02_container/src/_defaults.sass +147 -0
  57. data/examples/susy/extensions/susy/docs/tutorial/code/02_container/src/screen.sass +19 -0
  58. data/examples/susy/extensions/susy/docs/tutorial/code/03_structure/src/_defaults.sass +147 -0
  59. data/examples/susy/extensions/susy/docs/tutorial/code/03_structure/src/screen.sass +48 -0
  60. data/examples/susy/extensions/susy/docs/tutorial/code/_common/config.rb +14 -0
  61. data/examples/susy/extensions/susy/docs/tutorial/code/_common/images/grid.png +0 -0
  62. data/examples/susy/extensions/susy/docs/tutorial/code/_common/images/susy_logo.png +0 -0
  63. data/examples/susy/extensions/susy/docs/tutorial/code/_common/src/_base.sass +63 -0
  64. data/examples/susy/extensions/susy/docs/tutorial/code/_tools/Markdown.pl +1450 -0
  65. data/examples/susy/extensions/susy/docs/tutorial/code/site/src/_defaults.sass +100 -0
  66. data/examples/susy/extensions/susy/docs/tutorial/code/site/src/screen.sass +91 -0
  67. data/examples/susy/extensions/susy/docs/tutorial/figures/susy_element.png +0 -0
  68. data/examples/susy/extensions/susy/docs/tutorial/figures/susy_grid.png +0 -0
  69. data/examples/susy/extensions/susy/docs/tutorial/index.mkdn +301 -0
  70. data/examples/susy/extensions/susy/lib/susy.rb +2 -0
  71. data/examples/susy/extensions/susy/lib/susy/compass_plugin.rb +5 -0
  72. data/examples/susy/extensions/susy/lib/susy/sass_extensions.rb +79 -0
  73. data/examples/susy/extensions/susy/sass/susy/_grid.sass +128 -0
  74. data/examples/susy/extensions/susy/sass/susy/_reset.sass +7 -0
  75. data/examples/susy/extensions/susy/sass/susy/_susy.sass +23 -0
  76. data/examples/susy/extensions/susy/sass/susy/_text.sass +15 -0
  77. data/examples/susy/extensions/susy/sass/susy/_utils.sass +81 -0
  78. data/examples/susy/extensions/susy/templates/project/_base.sass +62 -0
  79. data/examples/susy/extensions/susy/templates/project/_defaults.sass +147 -0
  80. data/examples/susy/extensions/susy/templates/project/ie.sass +9 -0
  81. data/examples/susy/extensions/susy/templates/project/manifest.rb +5 -0
  82. data/examples/susy/extensions/susy/templates/project/print.sass +7 -0
  83. data/examples/susy/extensions/susy/templates/project/screen.sass +44 -0
  84. data/examples/susy/src/_base.sass +62 -0
  85. data/examples/susy/src/_defaults.sass +148 -0
  86. data/examples/susy/src/screen.sass +114 -0
  87. data/examples/yui/extensions/yui/stylesheets/_yui.sass +7 -0
  88. data/examples/yui/extensions/yui/stylesheets/yui/modules/_base.sass +70 -0
  89. data/examples/yui/extensions/yui/stylesheets/yui/modules/_fonts.sass +45 -0
  90. data/examples/yui/extensions/yui/stylesheets/yui/modules/_grids.sass +385 -0
  91. data/examples/yui/extensions/yui/stylesheets/yui/modules/_reset.sass +61 -0
  92. data/examples/yui/extensions/yui/templates/project/manifest.rb +1 -0
  93. data/examples/yui/extensions/yui/templates/project/screen.sass +4 -0
  94. data/lib/compass/app_integration/rails/configuration_defaults.rb +9 -1
  95. data/lib/compass/commands/watch_project.rb +1 -1
  96. data/lib/compass/compiler.rb +9 -1
  97. data/lib/compass/configuration.rb +23 -18
  98. data/lib/compass/configuration/adapters.rb +1 -1
  99. data/lib/compass/configuration/defaults.rb +30 -0
  100. data/lib/compass/frameworks.rb +1 -1
  101. data/lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass +29 -1
  102. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_buttons.sass +84 -0
  103. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_colors.sass +33 -0
  104. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_debug.sass +9 -0
  105. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_fancy_type.sass +82 -0
  106. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_form.sass +56 -0
  107. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_grid.sass +179 -0
  108. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass +2 -2
  109. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_interaction.sass +58 -0
  110. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_link_icons.sass +44 -0
  111. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_liquid.sass +141 -0
  112. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass +1 -4
  113. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass +57 -2
  114. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_rtl.sass +123 -0
  115. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_scaffolding.sass +49 -0
  116. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass +2 -29
  117. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_typography.sass +162 -0
  118. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/_utilities.sass +37 -0
  119. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +2 -84
  120. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +2 -33
  121. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +2 -9
  122. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +2 -82
  123. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +2 -55
  124. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +2 -178
  125. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +2 -58
  126. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass +2 -44
  127. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +2 -140
  128. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +2 -56
  129. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +2 -122
  130. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +2 -47
  131. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +2 -160
  132. data/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +2 -37
  133. data/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass +2 -2
  134. data/lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass +1 -1
  135. data/lib/compass/frameworks/blueprint/templates/project/screen.sass +1 -7
  136. data/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml +5 -2
  137. data/lib/compass/frameworks/compass/stylesheets/compass/_css3.sass +8 -0
  138. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_background_clip.sass +16 -0
  139. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_background_origin.sass +18 -0
  140. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_background_size.sass +14 -0
  141. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_shadow.sass +18 -10
  142. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_font_face.sass +31 -0
  143. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_gradient.sass +40 -0
  144. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_text_shadow.sass +15 -0
  145. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_transform.sass +60 -0
  146. data/lib/compass/frameworks/compass/stylesheets/compass/css3/_transition.sass +57 -0
  147. data/lib/compass/grid_builder.rb +1 -1
  148. data/lib/compass/installers/base.rb +5 -1
  149. data/lib/compass/installers/manifest.rb +1 -0
  150. data/lib/compass/logger.rb +28 -2
  151. data/lib/compass/sass_extensions/functions.rb +3 -1
  152. data/lib/compass/sass_extensions/functions/color_stop.rb +10 -0
  153. data/lib/compass/sass_extensions/functions/enumerate.rb +2 -2
  154. data/lib/compass/sass_extensions/functions/font_files.rb +11 -0
  155. data/lib/compass/sass_extensions/functions/inline_image.rb +22 -1
  156. data/lib/compass/sass_extensions/functions/urls.rb +20 -0
  157. data/lib/vendor/fssm.rb +19 -6
  158. data/lib/vendor/fssm/backends/fsevents.rb +19 -60
  159. data/lib/vendor/fssm/backends/polling.rb +20 -18
  160. data/lib/vendor/fssm/cache.rb +193 -0
  161. data/lib/vendor/fssm/ext.rb +30 -0
  162. data/lib/vendor/fssm/fsevents.rb +129 -0
  163. data/lib/vendor/fssm/monitor.rb +10 -6
  164. data/lib/vendor/fssm/path.rb +24 -21
  165. data/lib/vendor/fssm/state.rb +37 -29
  166. data/lib/vendor/fssm/support.rb +3 -7
  167. data/lib/vendor/fssm/tree.rb +176 -0
  168. data/test/command_line_helper.rb +8 -4
  169. data/test/command_line_test.rb +2 -2
  170. data/test/compass_test.rb +14 -4
  171. data/test/configuration_test.rb +5 -5
  172. data/test/fixtures/stylesheets/blueprint/css/typography.css +5 -3
  173. data/test/fixtures/stylesheets/blueprint/sass/screen.sass +1 -1
  174. data/test/fixtures/stylesheets/blueprint/sass/typography.sass +2 -2
  175. data/test/fixtures/stylesheets/compass/css/print.css +2 -8
  176. data/test/fixtures/stylesheets/image_urls/css/screen.css +2 -0
  177. data/test/fixtures/stylesheets/relative/assets/images/testing.png +0 -0
  178. data/test/fixtures/stylesheets/relative/config.rb +9 -0
  179. data/test/fixtures/stylesheets/relative/css/ie.css +1 -0
  180. data/test/fixtures/stylesheets/relative/css/print.css +1 -0
  181. data/test/fixtures/stylesheets/relative/css/screen.css +1 -0
  182. data/test/fixtures/stylesheets/relative/sass/ie.sass +6 -0
  183. data/test/fixtures/stylesheets/relative/sass/print.sass +6 -0
  184. data/test/fixtures/stylesheets/relative/sass/screen.sass +3 -0
  185. data/test/rails_integration_test.rb +1 -1
  186. data/test/sass_extensions_test.rb +2 -2
  187. metadata +120 -2
@@ -0,0 +1,60 @@
1
+ // CSS Transform and Transform-Origin
2
+
3
+ // Apply a transform sent as a complete string
4
+ =apply_transform(!transform = false)
5
+ transform= !transform
6
+ -webkit-transform= !transform
7
+ -moz-transform= !transform
8
+
9
+ // Apply a transform-origin sent as a complete string
10
+ =apply_origin(!origin = false)
11
+ transform-origin= !origin
12
+ -webkit-transform-origin= !origin
13
+ -moz-transform-origin= !origin
14
+
15
+ // transform-origin requires x and y coordinates
16
+ // - only applies the coordinates if they are there
17
+ // so that it can be called by scale, rotate and skew safely
18
+ =transform-origin(!originx = 50%, !originy = 50%)
19
+ !origin = false
20
+ @if !originx
21
+ !origin = "#{!originx}"
22
+ @if !originy
23
+ !origin = !origin + "#{!originy}"
24
+ @if !origin
25
+ +apply_origin(!origin)
26
+
27
+ // A full transform mixin with everything you could want
28
+ // - including origin adjustments if you want them
29
+ // - scale, rotate and skew don't require units
30
+ // scale takes a multiplier, rotate and skew take degrees
31
+ =transform(!scale = 1, !rotate = 0, !transx = 0, !transy = 0, !skewx = 0, !skewy = 0, !originx = false, !originy = false)
32
+ !transform = "scale(#{!scale}) rotate(#{!rotate}deg) translate(#{!transx}, #{!transy}) skew(#{!skewx}deg, #{!skewy}deg)"
33
+ +apply_transform(!transform)
34
+ +transform-origin(!originx, !originy)
35
+
36
+ // Transform Partials
37
+ // These work well on their own, but they don't add to each other, they override
38
+ // Use them with extra origin args, or along side +transform-origin
39
+
40
+ // adjust only the scale
41
+ // - with optional origin coordinates
42
+ =scale(!scale = 1.25, !originx = false, !originy = false)
43
+ +apply_transform("scale(#{!scale})")
44
+ +transform-origin(!originx, !originy)
45
+
46
+ // adjust only the rotation
47
+ // - with optional origin coordinates
48
+ =rotate(!rotate = 45, !originx = false, !originy = false)
49
+ +apply_transform("rotate(#{!rotate}deg)")
50
+ +transform-origin(!originx, !originy)
51
+
52
+ // adjust only the translation
53
+ =translate(!transx = 0, !transy = 0)
54
+ +apply_transform("translate(#{!transx}, #{!transy})")
55
+
56
+ // adjust only the skew
57
+ // - with optional origin coordinates
58
+ =skew(!skewx = 0, !skewy = 0, !originx = false, !originy = false)
59
+ +apply_transform("skew(#{!skewx}deg, #{!skewy}deg)")
60
+ +transform-origin(!originx, !originy)
@@ -0,0 +1,57 @@
1
+ // CSS Transitions
2
+ // Currently only works in Webkit
3
+ // - expected in CSS3, FireFox 3.6/7 and Opera Presto 2.3
4
+ // - we'll be prepared.
5
+
6
+ // Override these defaults with your own, if you like
7
+ // - timing-function and delay are set to false for browser defaults (ease, 0s)
8
+ !default_transition_property ||= "all"
9
+ !default_transition_duration ||= 1s
10
+ !default_transition_function ||= false
11
+ !default_transition_delay ||= false
12
+
13
+ // One or more properties to transition
14
+ // - for multiple, use a comma-delimited list
15
+ // - also accepts "all" or "none"
16
+ =transition-property(!properties = !default_transition_property)
17
+ transition-property = !properties
18
+ -webkit-transition-property = !properties
19
+ -moz-transition-property = !properties
20
+ -o-transition-property = !properties
21
+
22
+ // One or more durrations in seconds
23
+ // - for multiple, use a comma-delimited list
24
+ // - these durrations will effect the properties in the same list position
25
+ =transition-duration(!duration = !default_transition_duration)
26
+ transition-duration = !duration
27
+ -webkit-transition-duration = !duration
28
+ -moz-transition-duration = !duration
29
+ -o-transition-duration = !duration
30
+
31
+ // One or more timing functions
32
+ // - [ ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier(x1, y1, x2, y2)]
33
+ // - for multiple, use a comma-delimited list
34
+ // - these functions will effect the properties in the same list position
35
+ =transition-timing-function(!function = !default_transition_function)
36
+ transition-timing-function = !function
37
+ -webkit-transition-timing-function = !function
38
+ -moz-transition-timing-function = !function
39
+ -o-transition-timing-function = !function
40
+
41
+ // One or more transition-delays in seconds
42
+ // - for multiple, use a comma-delimited list
43
+ // - these delays will effect the properties in the same list position
44
+ =transition-delay(!delay = !default_transition_delay)
45
+ transition-delay = !delay
46
+ -webkit-transition-delay = !delay
47
+ -moz-transition-delay = !delay
48
+ -o-transition-delay = !delay
49
+
50
+ // Transition all-in-one shorthand
51
+ =transition(!properties = !default_transition_property, !duration = !default_transition_duration, !function = !default_transition_function, !delay = !default_transition_delay)
52
+ +transition-property(!properties)
53
+ +transition-duration(!duration)
54
+ @if !function
55
+ +transition-timing-function(!function)
56
+ @if !delay
57
+ +transition-delay(!delay)
@@ -48,7 +48,7 @@ module Compass
48
48
  canvas.background_fill = 'white'
49
49
 
50
50
  canvas.g do |column|
51
- column.rect(self.column_width, @height).styles(:fill => "#e8effb")
51
+ column.rect(self.column_width - 1, @height).styles(:fill => "#e8effb")
52
52
  end
53
53
 
54
54
  canvas.g do |baseline|
@@ -16,7 +16,7 @@ module Compass
16
16
  self.logger = options[:logger]
17
17
  end
18
18
 
19
- [:css_dir, :sass_dir, :images_dir, :javascripts_dir, :http_stylesheets_path].each do |dir|
19
+ [:css_dir, :sass_dir, :images_dir, :javascripts_dir, :http_stylesheets_path, :fonts_dir].each do |dir|
20
20
  define_method dir do
21
21
  Compass.configuration.send(dir)
22
22
  end
@@ -91,6 +91,10 @@ module Compass
91
91
  "#{javascripts_dir}/#{to}"
92
92
  end
93
93
 
94
+ installer :font do |to|
95
+ "#{fonts_dir}/#{to}"
96
+ end
97
+
94
98
  installer :file do |to|
95
99
  "#{pattern_name_as_dir}#{to}"
96
100
  end
@@ -37,6 +37,7 @@ module Compass
37
37
  type :stylesheet
38
38
  type :image
39
39
  type :javascript
40
+ type :font
40
41
  type :file
41
42
  type :html
42
43
 
@@ -1,7 +1,20 @@
1
1
  module Compass
2
2
  class Logger
3
3
 
4
- DEFAULT_ACTIONS = [:directory, :exists, :remove, :create, :overwrite, :compile]
4
+ DEFAULT_ACTIONS = [:directory, :exists, :remove, :create, :overwrite, :compile, :error, :identical]
5
+
6
+ ACTION_COLORS = {
7
+ :error => :red,
8
+ :compile => :green,
9
+ :overwrite => :yellow,
10
+ :create => :green,
11
+ :remove => :yellow,
12
+ :exists => :green,
13
+ :directory => :green,
14
+ :identical => :green
15
+ }
16
+
17
+ COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33 }
5
18
 
6
19
  attr_accessor :actions, :options
7
20
 
@@ -13,9 +26,22 @@ module Compass
13
26
 
14
27
  # Record an action that has occurred
15
28
  def record(action, *arguments)
29
+ emit color(ACTION_COLORS[action]) if Compass.configuration.color_output
16
30
  log "#{action_padding(action)}#{action} #{arguments.join(' ')}"
31
+ emit color(:clear) if Compass.configuration.color_output
17
32
  end
18
33
 
34
+ def color(c)
35
+ if c && COLORS.has_key?(c.to_sym)
36
+ "\e[#{COLORS[c.to_sym]}m"
37
+ else
38
+ ""
39
+ end
40
+ end
41
+
42
+ def emit(msg)
43
+ print msg
44
+ end
19
45
  # Emit a log message
20
46
  def log(msg)
21
47
  puts msg
@@ -39,4 +65,4 @@ module Compass
39
65
  def log(msg)
40
66
  end
41
67
  end
42
- end
68
+ end
@@ -1,7 +1,7 @@
1
1
  module Compass::SassExtensions::Functions
2
2
  end
3
3
 
4
- %w(selectors enumerate urls display inline_image).each do |func|
4
+ %w(selectors enumerate urls display inline_image color_stop font_files).each do |func|
5
5
  require "compass/sass_extensions/functions/#{func}"
6
6
  end
7
7
 
@@ -11,6 +11,8 @@ module Sass::Script::Functions
11
11
  include Compass::SassExtensions::Functions::Urls
12
12
  include Compass::SassExtensions::Functions::Display
13
13
  include Compass::SassExtensions::Functions::InlineImage
14
+ include Compass::SassExtensions::Functions::ColorStop
15
+ include Compass::SassExtensions::Functions::FontFiles
14
16
  end
15
17
 
16
18
  # Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
@@ -0,0 +1,10 @@
1
+ module Compass::SassExtensions::Functions::ColorStop
2
+ def color_stop(*args)
3
+ raise Sass::SyntaxError, "An even number of arguments must be passed to color-stop()" unless args.size % 2 == 0
4
+ stops = []
5
+ while args.size > 0
6
+ stops << "color-stop(#{args.shift}, #{args.shift})"
7
+ end
8
+ Sass::Script::String.new(stops.join(", "))
9
+ end
10
+ end
@@ -1,6 +1,6 @@
1
1
  module Compass::SassExtensions::Functions::Enumerate
2
- def enumerate(prefix, from, through)
3
- selectors = (from.value..through.value).map{|i| "#{prefix.value}-#{i}"}.join(", ")
2
+ def enumerate(prefix, from, through, separator = "-")
3
+ selectors = (from.value..through.value).map{|i| "#{prefix.value}#{separator}#{i}"}.join(", ")
4
4
  Sass::Script::String.new(selectors)
5
5
  end
6
6
  end
@@ -0,0 +1,11 @@
1
+ module Compass::SassExtensions::Functions::FontFiles
2
+ def font_files(*args)
3
+ raise Sass::SyntaxError, "An even number of arguments must be passed to font_files()" unless args.size % 2 == 0
4
+ files = []
5
+ while args.size > 0
6
+ files << "#{font_url(args.shift)} format('#{args.shift}')"
7
+ end
8
+ Sass::Script::String.new(files.join(", "))
9
+ end
10
+
11
+ end
@@ -3,11 +3,24 @@ module Compass::SassExtensions::Functions::InlineImage
3
3
 
4
4
  def inline_image(path, mime_type = nil)
5
5
  path = path.value
6
- real_path = File.join(Compass.configuration.project_path, Compass.configuration.images_dir, path)
6
+ real_path = File.join(Compass.configuration.images_path, path)
7
7
  url = "url('data:#{compute_mime_type(path,mime_type)};base64,#{data(real_path)}')"
8
8
  Sass::Script::String.new(url)
9
9
  end
10
10
 
11
+ def inline_font_files(*args)
12
+ raise Sass::SyntaxError, "An even number of arguments must be passed to font_files()" unless args.size % 2 == 0
13
+ path = path.value
14
+ files = []
15
+ while args.size > 0
16
+ path = args.shift.value
17
+ real_path = File.join(Compass.configuration.fonts_path, path)
18
+ url = "url('data:#{compute_mime_type(path,mime_type)};base64,#{data(real_path)}')"
19
+ files << "#{url} format('#{args.shift}')"
20
+ end
21
+ Sass::Script::String.new(files.join(", "))
22
+ end
23
+
11
24
  private
12
25
  def compute_mime_type(path, mime_type)
13
26
  return mime_type if mime_type
@@ -18,6 +31,14 @@ private
18
31
  'image/jpeg'
19
32
  when /\.gif$/i
20
33
  'image/gif'
34
+ when /\.otf$/i
35
+ 'font/opentype'
36
+ when /\.ttf$/i
37
+ 'font/truetype'
38
+ when /\.woff$/i
39
+ 'font/woff'
40
+ when /\.off$/i
41
+ 'font/openfont'
21
42
  when /\.([a-zA-Z]+)$/
22
43
  "image/#{Regexp.last_match(1).downcase}"
23
44
  else
@@ -14,8 +14,28 @@ module Compass::SassExtensions::Functions::Urls
14
14
  url("#{http_stylesheets_path}/#{path}")
15
15
  end
16
16
 
17
+ def font_url(path)
18
+ path = path.value # get to the string value of the literal.
19
+
20
+ # Short curcuit if they have provided an absolute url.
21
+ if absolute_path?(path)
22
+ return Sass::Script::String.new("url(#{path})")
23
+ end
24
+
25
+ # Compute the path to the font file, either root relative or stylesheet relative
26
+ # or nil if the http_fonts_path cannot be determined from the configuration.
27
+ http_fonts_path = if relative?
28
+ compute_relative_path(Compass.configuration.fonts_dir)
29
+ else
30
+ Compass.configuration.http_fonts_path
31
+ end
32
+
33
+ url("#{http_fonts_path}/#{path}")
34
+ end
35
+
17
36
  def image_url(path)
18
37
  path = path.value # get to the string value of the literal.
38
+
19
39
  # Short curcuit if they have provided an absolute url.
20
40
  if absolute_path?(path)
21
41
  return Sass::Script::String.new("url(#{path})")
@@ -1,28 +1,41 @@
1
+ dir = File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
3
+
1
4
  module FSSM
2
5
  FileNotFoundError = Class.new(StandardError)
3
6
  CallbackError = Class.new(StandardError)
4
7
 
5
8
  class << self
6
- def monitor(*args, &block)
9
+ def dbg(msg=nil)
10
+ STDERR.puts(msg)
11
+ end
12
+
13
+ def monitor(*args, &block)
7
14
  monitor = FSSM::Monitor.new
8
15
  context = args.empty? ? monitor : monitor.path(*args)
9
- if block && block.arity == 0
10
- context.instance_eval(&block)
11
- elsif block && block.arity == 1
12
- block.call(context)
16
+
17
+ if block_given?
18
+ if block.arity == 1
19
+ block.call(context)
20
+ else
21
+ context.instance_eval(&block)
22
+ end
13
23
  end
24
+
14
25
  monitor.run
15
26
  end
16
27
  end
17
28
  end
18
29
 
30
+ require 'thread'
19
31
  require 'pathname'
32
+
20
33
  require 'fssm/ext'
21
34
  require 'fssm/support'
35
+ require 'fssm/tree'
22
36
  require 'fssm/path'
23
37
  require 'fssm/state'
24
38
  require 'fssm/monitor'
25
39
 
26
40
  require "fssm/backends/#{FSSM::Support.backend.downcase}"
27
41
  FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend)
28
-
@@ -1,78 +1,37 @@
1
+ require 'fssm/fsevents'
2
+
1
3
  module FSSM::Backends
2
- class FSEvents
3
- def initialize(options={})
4
- @streams = []
5
- @handlers = {}
6
- @allocator = options[:allocator] || OSX::KCFAllocatorDefault
7
- @context = options[:context] || nil
8
- @since = options[:since] || OSX::KFSEventStreamEventIdSinceNow
9
- @latency = options[:latency] || 0.0
10
- @flags = options[:flags] || 0
4
+ class FSEvents
5
+ def initialize
6
+ @handlers = {}
7
+ @fsevents = []
11
8
  end
12
9
 
13
10
  def add_path(path, preload=true)
14
- @handlers["#{path}"] = FSSM::State.new(path, preload)
11
+ handler = FSSM::State.new(path)
12
+ @handlers["#{path}"] = handler
15
13
 
16
- cb = lambda do |stream, context, number, paths, flags, ids|
17
- paths.regard_as('*')
18
- watched = OSX.FSEventStreamCopyPathsBeingWatched(stream).first
19
- @handlers["#{watched}"].refresh
20
- # TODO: support this level of granularity
21
- # number.times do |n|
22
- # @handlers["#{watched}"].refresh_path(paths[n])
23
- # end
14
+ fsevent = Rucola::FSEvents.new("#{path}", {:latency => 0.5}) do |events|
15
+ events.each do |event|
16
+ handler.refresh(event.path)
17
+ end
24
18
  end
25
19
 
26
- @streams << create_stream(cb, "#{path}")
20
+ fsevent.create_stream
21
+ handler.refresh(path.to_pathname, true) if preload
22
+ fsevent.start
23
+ @fsevents << fsevent
27
24
  end
28
25
 
29
26
  def run
30
- @streams.each do |stream|
31
- schedule_stream(stream)
32
- start_stream(stream)
33
- end
34
-
35
27
  begin
36
28
  OSX.CFRunLoopRun
37
29
  rescue Interrupt
38
- @streams.each do |stream|
39
- stop_stream(stream)
40
- invalidate_stream(stream)
41
- release_stream(stream)
30
+ @fsevents.each do |fsev|
31
+ fsev.stop
42
32
  end
43
33
  end
44
-
45
- end
46
-
47
- private
48
-
49
- def create_stream(callback, paths)
50
- paths = [paths] unless paths.is_a?(Array)
51
- OSX.FSEventStreamCreate(@allocator, callback, @context, paths, @since, @latency, @flags)
52
- end
53
-
54
- def schedule_stream(stream, options={})
55
- run_loop = options[:run_loop] || OSX.CFRunLoopGetCurrent
56
- loop_mode = options[:loop_mode] || OSX::KCFRunLoopDefaultMode
57
-
58
- OSX.FSEventStreamScheduleWithRunLoop(stream, run_loop, loop_mode)
59
34
  end
60
-
61
- def start_stream(stream)
62
- OSX.FSEventStreamStart(stream)
63
- end
64
-
65
- def stop_stream(stream)
66
- OSX.FSEventStreamStop(stream)
67
- end
68
-
69
- def invalidate_stream(stream)
70
- OSX.FSEventStreamInvalidate(stream)
71
- end
72
-
73
- def release_stream(stream)
74
- OSX.FSEventStreamRelease(stream)
75
- end
76
-
35
+
77
36
  end
78
37
  end