compass 0.11.7 → 0.12.alpha.0

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.
Files changed (207) hide show
  1. data/Rakefile +10 -0
  2. data/VERSION.yml +4 -3
  3. data/bin/compass +1 -5
  4. data/features/command_line.feature +17 -17
  5. data/features/extensions.feature +0 -6
  6. data/features/step_definitions/command_line_steps.rb +1 -2
  7. data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +35 -5
  8. data/frameworks/compass/stylesheets/compass/css3/_images.scss +6 -6
  9. data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +3 -12
  10. data/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss +1 -1
  11. data/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss +11 -14
  12. data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +5 -5
  13. data/frameworks/compass/templates/pie/PIE.htc +64 -83
  14. data/lib/compass.rbc +36 -42
  15. data/lib/compass/actions.rb +1 -0
  16. data/lib/compass/actions.rbc +85 -244
  17. data/lib/compass/app_integration.rbc +20 -28
  18. data/lib/compass/app_integration/merb.rbc +4 -8
  19. data/lib/compass/app_integration/rails.rb +22 -5
  20. data/lib/compass/app_integration/rails.rbc +142 -658
  21. data/lib/compass/app_integration/rails/actionpack2x.rb +10 -0
  22. data/lib/compass/app_integration/rails/{actionpack2 → actionpack2x}/action_controller.rb +0 -0
  23. data/lib/compass/app_integration/rails/{actionpack2 → actionpack2x}/sass_plugin.rb +0 -0
  24. data/lib/compass/app_integration/rails/{actionpack2 → actionpack2x}/urls.rb +0 -0
  25. data/lib/compass/app_integration/rails/actionpack30.rb +11 -0
  26. data/lib/compass/app_integration/rails/{actionpack3 → actionpack30}/railtie.rb +0 -0
  27. data/lib/compass/app_integration/rails/actionpack31.rb +5 -0
  28. data/lib/compass/app_integration/rails/actionpack31/helpers.rb +5 -0
  29. data/lib/compass/app_integration/rails/actionpack31/railtie.rb +89 -0
  30. data/lib/compass/app_integration/rails/configuration_defaults.rb +54 -14
  31. data/lib/compass/app_integration/rails/configuration_defaults.rbc +324 -1081
  32. data/lib/compass/app_integration/rails/installer.rbc +61 -145
  33. data/lib/compass/app_integration/rails/runtime.rb +6 -16
  34. data/lib/compass/app_integration/stand_alone.rbc +15 -15
  35. data/lib/compass/app_integration/stand_alone/configuration_defaults.rbc +23 -23
  36. data/lib/compass/app_integration/stand_alone/installer.rbc +32 -52
  37. data/lib/compass/browser_support.rbc +23 -35
  38. data/lib/compass/commands/clean_project.rb +1 -1
  39. data/lib/compass/commands/project_stats.rb +7 -7
  40. data/lib/compass/commands/sprite.rb +4 -3
  41. data/lib/compass/compiler.rb +2 -2
  42. data/lib/compass/compiler.rbc +398 -591
  43. data/lib/compass/configuration.rb +2 -0
  44. data/lib/compass/configuration.rbc +78 -134
  45. data/lib/compass/configuration/adapters.rbc +40 -98
  46. data/lib/compass/configuration/comments.rb +5 -1
  47. data/lib/compass/configuration/comments.rbc +51 -132
  48. data/lib/compass/configuration/data.rb +26 -10
  49. data/lib/compass/configuration/data.rbc +536 -526
  50. data/lib/compass/configuration/defaults.rb +24 -1
  51. data/lib/compass/configuration/defaults.rbc +187 -762
  52. data/lib/compass/configuration/file_data.rb +0 -22
  53. data/lib/compass/configuration/file_data.rbc +125 -37
  54. data/lib/compass/configuration/helpers.rb +9 -8
  55. data/lib/compass/configuration/helpers.rbc +153 -433
  56. data/lib/compass/configuration/inheritance.rb +13 -0
  57. data/lib/compass/configuration/inheritance.rbc +165 -412
  58. data/lib/compass/configuration/paths.rbc +9 -9
  59. data/lib/compass/configuration/serialization.rb +1 -0
  60. data/lib/compass/configuration/serialization.rbc +84 -151
  61. data/lib/compass/dependencies.rbc +4 -16
  62. data/lib/compass/errors.rbc +5 -5
  63. data/lib/compass/frameworks.rb +4 -10
  64. data/lib/compass/frameworks.rbc +66 -118
  65. data/lib/compass/quick_cache.rbc +8 -12
  66. data/lib/compass/sass_extensions.rbc +4 -8
  67. data/lib/compass/sass_extensions/functions.rbc +57 -90
  68. data/lib/compass/sass_extensions/functions/colors.rbc +18 -22
  69. data/lib/compass/sass_extensions/functions/constants.rbc +25 -45
  70. data/lib/compass/sass_extensions/functions/cross_browser_support.rbc +36 -48
  71. data/lib/compass/sass_extensions/functions/display.rbc +107 -341
  72. data/lib/compass/sass_extensions/functions/enumerate.rbc +9 -9
  73. data/lib/compass/sass_extensions/functions/font_files.rbc +125 -542
  74. data/lib/compass/sass_extensions/functions/gradient_support.rbc +167 -379
  75. data/lib/compass/sass_extensions/functions/image_size.rb +10 -2
  76. data/lib/compass/sass_extensions/functions/image_size.rbc +400 -715
  77. data/lib/compass/sass_extensions/functions/inline_image.rbc +98 -152
  78. data/lib/compass/sass_extensions/functions/lists.rb +0 -5
  79. data/lib/compass/sass_extensions/functions/lists.rbc +39 -75
  80. data/lib/compass/sass_extensions/functions/selectors.rbc +28 -36
  81. data/lib/compass/sass_extensions/functions/sprites.rb +5 -7
  82. data/lib/compass/sass_extensions/functions/sprites.rbc +233 -255
  83. data/lib/compass/sass_extensions/functions/trig.rb +2 -1
  84. data/lib/compass/sass_extensions/functions/trig.rbc +51 -53
  85. data/lib/compass/sass_extensions/functions/urls.rb +171 -80
  86. data/lib/compass/sass_extensions/functions/urls.rbc +1051 -3158
  87. data/lib/compass/sass_extensions/monkey_patches.rbc +5 -5
  88. data/lib/compass/sass_extensions/monkey_patches/browser_support.rbc +47 -63
  89. data/lib/compass/sass_extensions/monkey_patches/traversal.rbc +16 -36
  90. data/lib/compass/sass_extensions/sprites.rb +3 -1
  91. data/lib/compass/sass_extensions/sprites.rbc +13 -93
  92. data/lib/compass/sass_extensions/sprites/engines.rbc +6 -615
  93. data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rbc +94 -260
  94. data/lib/compass/sass_extensions/sprites/image.rb +23 -11
  95. data/lib/compass/sass_extensions/sprites/image.rbc +313 -691
  96. data/lib/compass/sass_extensions/sprites/image_row.rb +47 -0
  97. data/lib/compass/sass_extensions/sprites/layout_methods.rb +117 -0
  98. data/lib/compass/sass_extensions/sprites/row_fitter.rb +86 -0
  99. data/lib/compass/sass_extensions/sprites/sprite_map.rb +18 -4
  100. data/lib/compass/sass_extensions/sprites/sprite_map.rbc +3635 -708
  101. data/lib/compass/sass_extensions/sprites/sprite_methods.rb +5 -17
  102. data/lib/compass/sprite_importer.rb +38 -62
  103. data/lib/compass/sprite_importer.rbc +1495 -1125
  104. data/lib/compass/util.rbc +11 -19
  105. data/lib/compass/version.rbc +25 -53
  106. data/test/fixtures/sprites/public/images/image_row/large.png +0 -0
  107. data/test/fixtures/sprites/public/images/image_row/large_square.png +0 -0
  108. data/test/fixtures/sprites/public/images/image_row/medium.png +0 -0
  109. data/test/fixtures/sprites/public/images/image_row/small.png +0 -0
  110. data/test/fixtures/sprites/public/images/image_row/tall.png +0 -0
  111. data/test/fixtures/stylesheets/compass/css/lists.css +7 -7
  112. data/test/fixtures/stylesheets/compass/css/reset.css +1 -0
  113. data/test/fixtures/stylesheets/compass/css/sprites.css +248 -248
  114. data/test/fixtures/stylesheets/compass/images/flag-s8c3c755a68.png +0 -0
  115. data/test/integrations/sprites_test.rb +115 -3
  116. data/test/test_helper.rb +29 -1
  117. data/test/tmp/compass_rails/public/images/selectors-sef52c5c63a.png +0 -0
  118. data/test/units/configuration_test.rb +2 -5
  119. data/test/units/rails_configuration_test.rb +50 -0
  120. data/test/units/sass_extensions_test.rb +17 -5
  121. data/test/units/sprites/image_row_test.rb +57 -0
  122. data/test/units/sprites/image_test.rb +53 -45
  123. data/test/units/sprites/importer_test.rb +31 -12
  124. data/test/units/sprites/row_fitter_test.rb +66 -0
  125. data/test/units/sprites/sprite_command_test.rb +1 -11
  126. data/test/units/sprites/sprite_map_test.rb +122 -16
  127. metadata +38 -149
  128. data/bin/compass.compiled.rbc +0 -707
  129. data/examples/compass/compass_app_log.txt +0 -6
  130. data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +0 -19
  131. data/lib/compass/commands.rbc +0 -307
  132. data/lib/compass/commands/base.rbc +0 -1044
  133. data/lib/compass/commands/clean_project.rbc +0 -1856
  134. data/lib/compass/commands/create_project.rbc +0 -2691
  135. data/lib/compass/commands/default.rbc +0 -1677
  136. data/lib/compass/commands/generate_grid_background.rbc +0 -1939
  137. data/lib/compass/commands/help.rbc +0 -1921
  138. data/lib/compass/commands/imports.rbc +0 -969
  139. data/lib/compass/commands/installer_command.rbc +0 -807
  140. data/lib/compass/commands/interactive.rbc +0 -1341
  141. data/lib/compass/commands/list_frameworks.rbc +0 -1111
  142. data/lib/compass/commands/print_version.rbc +0 -2478
  143. data/lib/compass/commands/project_base.rbc +0 -2085
  144. data/lib/compass/commands/project_stats.rbc +0 -4202
  145. data/lib/compass/commands/registry.rbc +0 -1350
  146. data/lib/compass/commands/sprite.rbc +0 -2212
  147. data/lib/compass/commands/stamp_pattern.rbc +0 -2011
  148. data/lib/compass/commands/unpack_extension.rbc +0 -2348
  149. data/lib/compass/commands/update_project.rbc +0 -3002
  150. data/lib/compass/commands/validate_project.rbc +0 -1686
  151. data/lib/compass/commands/watch_project.rbc +0 -4155
  152. data/lib/compass/commands/write_configuration.rbc +0 -2896
  153. data/lib/compass/exec.rbc +0 -500
  154. data/lib/compass/exec/command_option_parser.rbc +0 -676
  155. data/lib/compass/exec/global_options_parser.rbc +0 -1306
  156. data/lib/compass/exec/helpers.rbc +0 -758
  157. data/lib/compass/exec/project_options_parser.rbc +0 -1515
  158. data/lib/compass/exec/sub_command_ui.rbc +0 -1191
  159. data/lib/compass/grid_builder.rbc +0 -0
  160. data/lib/compass/installers.rbc +0 -152
  161. data/lib/compass/installers/bare_installer.rbc +0 -939
  162. data/lib/compass/installers/base.rbc +0 -4427
  163. data/lib/compass/installers/manifest.rbc +0 -3335
  164. data/lib/compass/installers/manifest_installer.rbc +0 -1591
  165. data/lib/compass/installers/template_context.rbc +0 -1030
  166. data/lib/compass/logger.rbc +0 -2317
  167. data/lib/compass/sass_extensions/functions/env.rbc +0 -299
  168. data/lib/compass/sass_extensions/sprites/image_methods.rbc +0 -900
  169. data/lib/compass/sass_extensions/sprites/image_row.rbc +0 -1168
  170. data/lib/compass/sass_extensions/sprites/layout_methods.rbc +0 -3236
  171. data/lib/compass/sass_extensions/sprites/row_fitter.rbc +0 -2067
  172. data/lib/compass/sass_extensions/sprites/sprite_methods.rbc +0 -3190
  173. data/test/fixtures/extensions/only_stylesheets/compass_init.rb +0 -1
  174. data/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss +0 -3
  175. data/test/fixtures/stylesheets/compass/css/user-interface.css +0 -5
  176. data/test/fixtures/stylesheets/compass/images/flag-s03c3b29b35.png +0 -0
  177. data/test/fixtures/stylesheets/compass/sass/user-interface.scss +0 -5
  178. data/test/fixtures/stylesheets/envtest/tmp/env.css +0 -2
  179. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb +0 -25
  180. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss +0 -5
  181. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss +0 -3
  182. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss +0 -6
  183. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css +0 -5
  184. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css +0 -3
  185. data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css +0 -68
  186. data/test/helpers/command_line.rbc +0 -2820
  187. data/test/helpers/diff.rbc +0 -1104
  188. data/test/helpers/io.rbc +0 -962
  189. data/test/helpers/rails.rbc +0 -1116
  190. data/test/helpers/test_case.rbc +0 -1255
  191. data/test/integrations/compass_test.rbc +0 -6589
  192. data/test/integrations/rails_integration_test.rbc +0 -1342
  193. data/test/integrations/sprites_test.rbc +0 -6192
  194. data/test/test_helper.rbc +0 -1694
  195. data/test/units/actions_test.rbc +0 -644
  196. data/test/units/command_line_test.rbc +0 -1532
  197. data/test/units/compass_png_test.rbc +0 -0
  198. data/test/units/configuration_test.rbc +0 -3833
  199. data/test/units/rails_configuration_test.rbc +0 -1032
  200. data/test/units/sass_extensions_test.rbc +0 -3586
  201. data/test/units/sprites/engine_test.rbc +0 -962
  202. data/test/units/sprites/image_row_test.rbc +0 -1578
  203. data/test/units/sprites/image_test.rbc +0 -2836
  204. data/test/units/sprites/importer_test.rbc +0 -2620
  205. data/test/units/sprites/row_fitter_test.rbc +0 -1479
  206. data/test/units/sprites/sprite_command_test.rbc +0 -1147
  207. data/test/units/sprites/sprite_map_test.rbc +0 -6515
@@ -19,9 +19,10 @@ module Compass::SassExtensions::Functions::Trig
19
19
  private
20
20
  def trig(operation, number)
21
21
  if number.numerator_units == ["deg"] && number.denominator_units == []
22
- Sass::Script::Number.new(Math.send(operation, Math::PI * number.value / 360))
22
+ Sass::Script::Number.new(Math.send(operation, (number.value * Math::PI / 180)))
23
23
  else
24
24
  Sass::Script::Number.new(Math.send(operation, number.value), number.numerator_units, number.denominator_units)
25
25
  end
26
26
  end
27
+
27
28
  end
@@ -1,5 +1,5 @@
1
1
  !RBIX
2
- 9595534255132031488
2
+ 333337424968067900
3
3
  x
4
4
  M
5
5
  1
@@ -272,8 +272,8 @@ I
272
272
  I
273
273
  27
274
274
  x
275
- 77
276
- /Users/crispee/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
275
+ 75
276
+ /Users/chris/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
277
277
  p
278
278
  0
279
279
  x
@@ -334,8 +334,8 @@ I
334
334
  I
335
335
  a
336
336
  x
337
- 77
338
- /Users/crispee/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
337
+ 75
338
+ /Users/chris/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
339
339
  p
340
340
  1
341
341
  x
@@ -393,8 +393,8 @@ c
393
393
  I
394
394
  a
395
395
  x
396
- 77
397
- /Users/crispee/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
396
+ 75
397
+ /Users/chris/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
398
398
  p
399
399
  1
400
400
  x
@@ -452,8 +452,8 @@ I
452
452
  I
453
453
  a
454
454
  x
455
- 77
456
- /Users/crispee/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
455
+ 75
456
+ /Users/chris/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
457
457
  p
458
458
  1
459
459
  x
@@ -524,59 +524,59 @@ i
524
524
  11
525
525
  20
526
526
  0
527
- 20
528
- 1
529
- 49
530
- 12
531
- 0
532
527
  45
533
528
  10
534
- 13
529
+ 12
535
530
  43
531
+ 13
532
+ 20
533
+ 1
534
+ 49
536
535
  14
536
+ 0
537
537
  49
538
538
  15
539
539
  1
540
- 4
541
- 180
542
- 49
540
+ 7
543
541
  16
544
- 1
545
542
  49
546
543
  17
544
+ 1
545
+ 49
546
+ 18
547
547
  2
548
548
  47
549
549
  49
550
- 18
550
+ 19
551
551
  1
552
552
  15
553
553
  8
554
554
  107
555
555
  45
556
556
  10
557
- 19
558
557
  20
559
- 0
560
558
  20
561
- 1
562
- 49
563
- 12
564
559
  0
565
560
  45
566
561
  10
567
- 20
562
+ 21
568
563
  43
564
+ 13
565
+ 20
566
+ 1
567
+ 49
569
568
  14
569
+ 0
570
570
  49
571
571
  15
572
572
  1
573
- 4
574
- 180
575
- 49
573
+ 7
576
574
  16
577
- 1
578
575
  49
579
576
  17
577
+ 1
578
+ 49
579
+ 18
580
580
  2
581
581
  49
582
582
  8
@@ -585,7 +585,7 @@ i
585
585
  183
586
586
  45
587
587
  4
588
- 21
588
+ 22
589
589
  43
590
590
  6
591
591
  43
@@ -603,16 +603,16 @@ i
603
603
  13
604
604
  45
605
605
  10
606
- 22
606
+ 23
607
607
  20
608
608
  0
609
609
  20
610
610
  1
611
611
  49
612
- 12
612
+ 14
613
613
  0
614
614
  49
615
- 17
615
+ 18
616
616
  2
617
617
  20
618
618
  1
@@ -626,23 +626,23 @@ i
626
626
  0
627
627
  47
628
628
  49
629
- 18
629
+ 19
630
630
  3
631
631
  15
632
632
  8
633
633
  183
634
634
  45
635
635
  10
636
- 23
636
+ 24
637
637
  20
638
638
  0
639
639
  20
640
640
  1
641
641
  49
642
- 12
642
+ 14
643
643
  0
644
644
  49
645
- 17
645
+ 18
646
646
  2
647
647
  20
648
648
  1
@@ -668,7 +668,7 @@ I
668
668
  2
669
669
  n
670
670
  p
671
- 24
671
+ 25
672
672
  x
673
673
  15
674
674
  numerator_units
@@ -701,16 +701,18 @@ x
701
701
  4
702
702
  Math
703
703
  n
704
- x
705
- 5
706
- value
707
704
  n
708
705
  x
709
706
  2
710
707
  PI
711
708
  x
709
+ 5
710
+ value
711
+ x
712
712
  1
713
713
  *
714
+ I
715
+ 168
714
716
  x
715
717
  1
716
718
  /
@@ -726,7 +728,7 @@ n
726
728
  n
727
729
  n
728
730
  p
729
- 11
731
+ 9
730
732
  I
731
733
  -1
732
734
  I
@@ -744,14 +746,10 @@ I
744
746
  I
745
747
  18
746
748
  I
747
- b7
748
- I
749
- 0
750
- I
751
749
  b8
752
750
  x
753
- 77
754
- /Users/crispee/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
751
+ 75
752
+ /Users/chris/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
755
753
  p
756
754
  2
757
755
  x
@@ -789,8 +787,8 @@ I
789
787
  I
790
788
  4c
791
789
  x
792
- 77
793
- /Users/crispee/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
790
+ 75
791
+ /Users/chris/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
794
792
  p
795
793
  0
796
794
  x
@@ -805,7 +803,7 @@ I
805
803
  I
806
804
  22
807
805
  x
808
- 77
809
- /Users/crispee/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
806
+ 75
807
+ /Users/chris/Projects/compass/lib/compass/sass_extensions/functions/trig.rb
810
808
  p
811
809
  0
@@ -1,112 +1,203 @@
1
1
  module Compass::SassExtensions::Functions::Urls
2
2
 
3
- def stylesheet_url(path, only_path = Sass::Script::Bool.new(false))
4
- # Compute the path to the stylesheet, either root relative or stylesheet relative
5
- # or nil if the http_images_path is not set in the configuration.
6
- http_stylesheets_path = if relative?
7
- compute_relative_path(Compass.configuration.css_path)
8
- elsif Compass.configuration.http_stylesheets_path
9
- Compass.configuration.http_stylesheets_path
10
- else
11
- Compass.configuration.http_root_relative(Compass.configuration.css_dir)
12
- end
13
3
 
14
- path = "#{http_stylesheets_path}/#{path.value}"
15
- if only_path.to_bool
16
- Sass::Script::String.new(clean_path(path))
17
- else
18
- clean_url(path)
19
- end
4
+ def self.has?(base, instance_method)
5
+ Sass::Util.has?(:instance_method, base, instance_method)
20
6
  end
21
- Sass::Script::Functions.declare :stylesheet_url, [:path]
22
- Sass::Script::Functions.declare :stylesheet_url, [:path, :only_path]
23
7
 
24
- def font_url(path, only_path = Sass::Script::Bool.new(false))
25
- path = path.value # get to the string value of the literal.
8
+ def self.included(base)
9
+ base.send(:include, StylesheetUrl) unless has?(base, :stylesheet_url)
10
+ base.send(:include, FontUrl) unless has?(base, :font_url)
11
+ base.send(:include, ImageUrl) unless has?(base, :image_url)
12
+ base.send(:include, GeneratedImageUrl) unless has?(base, :generated_image_url)
13
+ end
26
14
 
27
- # Short curcuit if they have provided an absolute url.
28
- if absolute_path?(path)
29
- return Sass::Script::String.new("url(#{path})")
15
+ module StylesheetUrl
16
+ def self.included(base)
17
+ if base.respond_to?(:declare)
18
+ base.declare :stylesheet_url, [:path]
19
+ base.declare :stylesheet_url, [:path, :only_path]
20
+ end
30
21
  end
22
+ def stylesheet_url(path, only_path = Sass::Script::Bool.new(false))
23
+ # Compute the path to the stylesheet, either root relative or stylesheet relative
24
+ # or nil if the http_images_path is not set in the configuration.
25
+ http_stylesheets_path = if relative?
26
+ compute_relative_path(Compass.configuration.css_path)
27
+ elsif Compass.configuration.http_stylesheets_path
28
+ Compass.configuration.http_stylesheets_path
29
+ else
30
+ Compass.configuration.http_root_relative(Compass.configuration.css_dir)
31
+ end
31
32
 
32
- # Compute the path to the font file, either root relative or stylesheet relative
33
- # or nil if the http_fonts_path cannot be determined from the configuration.
34
- http_fonts_path = if relative?
35
- compute_relative_path(Compass.configuration.fonts_path)
36
- else
37
- Compass.configuration.http_fonts_path
38
- end
39
-
40
- path = "#{http_fonts_path}/#{path}"
41
-
42
- if only_path.to_bool
43
- Sass::Script::String.new(clean_path(path))
44
- else
45
- clean_url(path)
33
+ path = "#{http_stylesheets_path}/#{path.value}"
34
+ if only_path.to_bool
35
+ Sass::Script::String.new(clean_path(path))
36
+ else
37
+ clean_url(path)
38
+ end
46
39
  end
47
40
  end
48
- Sass::Script::Functions.declare :font_url, [:path]
49
- Sass::Script::Functions.declare :font_url, [:path, :only_path]
50
41
 
51
- def image_url(path, only_path = Sass::Script::Bool.new(false), cache_buster = Sass::Script::Bool.new(true))
52
- path = path.value # get to the string value of the literal.
42
+ module FontUrl
43
+ def self.included(base)
44
+ if base.respond_to?(:declare)
45
+ base.declare :font_url, [:path]
46
+ base.declare :font_url, [:path, :only_path]
47
+ end
48
+ end
49
+ def font_url(path, only_path = Sass::Script::Bool.new(false))
50
+ path = path.value # get to the string value of the literal.
53
51
 
54
- if path =~ %r{^#{Regexp.escape(Compass.configuration.http_images_path)}/(.*)}
55
- # Treat root relative urls (without a protocol) like normal if they start with
56
- # the images path.
57
- path = $1
58
- elsif absolute_path?(path)
59
52
  # Short curcuit if they have provided an absolute url.
60
- return Sass::Script::String.new("url(#{path})")
61
- end
53
+ if absolute_path?(path)
54
+ return Sass::Script::String.new("url(#{path})")
55
+ end
62
56
 
63
- # Compute the path to the image, either root relative or stylesheet relative
64
- # or nil if the http_images_path is not set in the configuration.
65
- http_images_path = if relative?
66
- compute_relative_path(Compass.configuration.images_path)
67
- elsif Compass.configuration.http_images_path
68
- Compass.configuration.http_images_path
69
- else
70
- Compass.configuration.http_root_relative(Compass.configuration.images_dir)
57
+ # Compute the path to the font file, either root relative or stylesheet relative
58
+ # or nil if the http_fonts_path cannot be determined from the configuration.
59
+ http_fonts_path = if relative?
60
+ compute_relative_path(Compass.configuration.fonts_path)
61
+ else
62
+ Compass.configuration.http_fonts_path
63
+ end
64
+
65
+ path = "#{http_fonts_path}/#{path}"
66
+
67
+ if only_path.to_bool
68
+ Sass::Script::String.new(clean_path(path))
69
+ else
70
+ clean_url(path)
71
+ end
71
72
  end
73
+ end
72
74
 
73
- # Compute the real path to the image on the file stystem if the images_dir is set.
74
- real_path = if Compass.configuration.images_dir
75
- File.join(Compass.configuration.project_path, Compass.configuration.images_dir, path)
75
+ module ImageUrl
76
+ def self.included(base)
77
+ if base.respond_to?(:declare)
78
+ base.declare :image_url, [:path]
79
+ base.declare :image_url, [:path, :only_path]
80
+ base.declare :image_url, [:path, :only_path, :cache_buster]
81
+ end
76
82
  end
83
+ def image_url(path, only_path = Sass::Script::Bool.new(false), cache_buster = Sass::Script::Bool.new(true))
84
+ path = path.value # get to the string value of the literal.
85
+
86
+ if path =~ %r{^#{Regexp.escape(Compass.configuration.http_images_path)}/(.*)}
87
+ # Treat root relative urls (without a protocol) like normal if they start with
88
+ # the images path.
89
+ path = $1
90
+ elsif absolute_path?(path)
91
+ # Short curcuit if they have provided an absolute url.
92
+ return Sass::Script::String.new("url(#{path})")
93
+ end
77
94
 
78
- # prepend the path to the image if there's one
79
- if http_images_path
80
- http_images_path = "#{http_images_path}/" unless http_images_path[-1..-1] == "/"
81
- path = "#{http_images_path}#{path}"
95
+ # Compute the path to the image, either root relative or stylesheet relative
96
+ # or nil if the http_images_path is not set in the configuration.
97
+ http_images_path = if relative?
98
+ compute_relative_path(Compass.configuration.images_path)
99
+ elsif Compass.configuration.http_images_path
100
+ Compass.configuration.http_images_path
101
+ else
102
+ Compass.configuration.http_root_relative(Compass.configuration.images_dir)
103
+ end
104
+
105
+ # Compute the real path to the image on the file stystem if the images_dir is set.
106
+ real_path = if Compass.configuration.images_dir
107
+ File.join(Compass.configuration.project_path, Compass.configuration.images_dir, path)
108
+ end
109
+
110
+ # prepend the path to the image if there's one
111
+ if http_images_path
112
+ http_images_path = "#{http_images_path}/" unless http_images_path[-1..-1] == "/"
113
+ path = "#{http_images_path}#{path}"
114
+ end
115
+
116
+ # Compute the asset host unless in relative mode.
117
+ asset_host = if !relative? && Compass.configuration.asset_host
118
+ Compass.configuration.asset_host.call(path)
119
+ end
120
+
121
+ # Compute and append the cache buster if there is one.
122
+ if cache_buster.to_bool
123
+ if cache_buster.is_a?(Sass::Script::String)
124
+ path += "?#{cache_buster.value}"
125
+ else
126
+ path = cache_busted_path(path, real_path)
127
+ end
128
+ end
129
+
130
+ # prepend the asset host if there is one.
131
+ path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
132
+
133
+ if only_path.to_bool
134
+ Sass::Script::String.new(clean_path(path))
135
+ else
136
+ clean_url(path)
137
+ end
82
138
  end
139
+ end
83
140
 
84
- # Compute the asset host unless in relative mode.
85
- asset_host = if !relative? && Compass.configuration.asset_host
86
- Compass.configuration.asset_host.call(path)
141
+ module GeneratedImageUrl
142
+ def self.included(base)
143
+ if base.respond_to?(:declare)
144
+ base.declare :generated_image_url, [:path]
145
+ base.declare :generated_image_url, [:path, :cache_buster]
146
+ end
87
147
  end
148
+ def generated_image_url(path, cache_buster = Sass::Script::Bool.new(false))
149
+ path = path.value # get to the string value of the literal.
150
+
151
+ if path =~ %r{^#{Regexp.escape(Compass.configuration.http_generated_images_path)}/(.*)}
152
+ # Treat root relative urls (without a protocol) like normal if they start with
153
+ # the generated_images path.
154
+ path = $1
155
+ elsif absolute_path?(path)
156
+ # Short curcuit if they have provided an absolute url.
157
+ return Sass::Script::String.new("url(#{path})")
158
+ end
88
159
 
89
- # Compute and append the cache buster if there is one.
90
- if cache_buster.to_bool
91
- if cache_buster.is_a?(Sass::Script::String)
92
- path += "?#{cache_buster.value}"
160
+ # Compute the path to the image, either root relative or stylesheet relative
161
+ # or nil if the http_generated_images_path is not set in the configuration.
162
+ http_generated_images_path = if relative?
163
+ compute_relative_path(Compass.configuration.generated_images_path)
164
+ elsif Compass.configuration.http_generated_images_path
165
+ Compass.configuration.http_generated_images_path
93
166
  else
94
- path = cache_busted_path(path, real_path)
167
+ Compass.configuration.http_root_relative(Compass.configuration.generated_images_dir)
95
168
  end
96
- end
97
169
 
98
- # prepend the asset host if there is one.
99
- path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
170
+ # Compute the real path to the image on the file stystem if the generated_images_dir is set.
171
+ real_path = if Compass.configuration.generated_images_dir
172
+ File.join(Compass.configuration.project_path, Compass.configuration.generated_images_dir, path)
173
+ end
174
+
175
+ # prepend the path to the image if there's one
176
+ if http_generated_images_path
177
+ http_generated_images_path = "#{http_generated_images_path}/" unless http_generated_images_path[-1..-1] == "/"
178
+ path = "#{http_generated_images_path}#{path}"
179
+ end
180
+
181
+ # Compute the asset host unless in relative mode.
182
+ asset_host = if !relative? && Compass.configuration.asset_host
183
+ Compass.configuration.asset_host.call(path)
184
+ end
185
+
186
+ # Compute and append the cache buster if there is one.
187
+ if cache_buster.to_bool
188
+ if cache_buster.is_a?(Sass::Script::String)
189
+ path += "?#{cache_buster.value}"
190
+ else
191
+ path = cache_busted_path(path, real_path)
192
+ end
193
+ end
194
+
195
+ # prepend the asset host if there is one.
196
+ path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
100
197
 
101
- if only_path.to_bool
102
- Sass::Script::String.new(clean_path(path))
103
- else
104
198
  clean_url(path)
105
199
  end
106
200
  end
107
- Sass::Script::Functions.declare :image_url, [:path]
108
- Sass::Script::Functions.declare :image_url, [:path, :only_path]
109
- Sass::Script::Functions.declare :image_url, [:path, :only_path, :cache_buster]
110
201
 
111
202
  private
112
203