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.
- data/Rakefile +10 -0
- data/VERSION.yml +4 -3
- data/bin/compass +1 -5
- data/features/command_line.feature +17 -17
- data/features/extensions.feature +0 -6
- data/features/step_definitions/command_line_steps.rb +1 -2
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +35 -5
- data/frameworks/compass/stylesheets/compass/css3/_images.scss +6 -6
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +3 -12
- data/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss +1 -1
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss +11 -14
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +5 -5
- data/frameworks/compass/templates/pie/PIE.htc +64 -83
- data/lib/compass.rbc +36 -42
- data/lib/compass/actions.rb +1 -0
- data/lib/compass/actions.rbc +85 -244
- data/lib/compass/app_integration.rbc +20 -28
- data/lib/compass/app_integration/merb.rbc +4 -8
- data/lib/compass/app_integration/rails.rb +22 -5
- data/lib/compass/app_integration/rails.rbc +142 -658
- data/lib/compass/app_integration/rails/actionpack2x.rb +10 -0
- data/lib/compass/app_integration/rails/{actionpack2 → actionpack2x}/action_controller.rb +0 -0
- data/lib/compass/app_integration/rails/{actionpack2 → actionpack2x}/sass_plugin.rb +0 -0
- data/lib/compass/app_integration/rails/{actionpack2 → actionpack2x}/urls.rb +0 -0
- data/lib/compass/app_integration/rails/actionpack30.rb +11 -0
- data/lib/compass/app_integration/rails/{actionpack3 → actionpack30}/railtie.rb +0 -0
- data/lib/compass/app_integration/rails/actionpack31.rb +5 -0
- data/lib/compass/app_integration/rails/actionpack31/helpers.rb +5 -0
- data/lib/compass/app_integration/rails/actionpack31/railtie.rb +89 -0
- data/lib/compass/app_integration/rails/configuration_defaults.rb +54 -14
- data/lib/compass/app_integration/rails/configuration_defaults.rbc +324 -1081
- data/lib/compass/app_integration/rails/installer.rbc +61 -145
- data/lib/compass/app_integration/rails/runtime.rb +6 -16
- data/lib/compass/app_integration/stand_alone.rbc +15 -15
- data/lib/compass/app_integration/stand_alone/configuration_defaults.rbc +23 -23
- data/lib/compass/app_integration/stand_alone/installer.rbc +32 -52
- data/lib/compass/browser_support.rbc +23 -35
- data/lib/compass/commands/clean_project.rb +1 -1
- data/lib/compass/commands/project_stats.rb +7 -7
- data/lib/compass/commands/sprite.rb +4 -3
- data/lib/compass/compiler.rb +2 -2
- data/lib/compass/compiler.rbc +398 -591
- data/lib/compass/configuration.rb +2 -0
- data/lib/compass/configuration.rbc +78 -134
- data/lib/compass/configuration/adapters.rbc +40 -98
- data/lib/compass/configuration/comments.rb +5 -1
- data/lib/compass/configuration/comments.rbc +51 -132
- data/lib/compass/configuration/data.rb +26 -10
- data/lib/compass/configuration/data.rbc +536 -526
- data/lib/compass/configuration/defaults.rb +24 -1
- data/lib/compass/configuration/defaults.rbc +187 -762
- data/lib/compass/configuration/file_data.rb +0 -22
- data/lib/compass/configuration/file_data.rbc +125 -37
- data/lib/compass/configuration/helpers.rb +9 -8
- data/lib/compass/configuration/helpers.rbc +153 -433
- data/lib/compass/configuration/inheritance.rb +13 -0
- data/lib/compass/configuration/inheritance.rbc +165 -412
- data/lib/compass/configuration/paths.rbc +9 -9
- data/lib/compass/configuration/serialization.rb +1 -0
- data/lib/compass/configuration/serialization.rbc +84 -151
- data/lib/compass/dependencies.rbc +4 -16
- data/lib/compass/errors.rbc +5 -5
- data/lib/compass/frameworks.rb +4 -10
- data/lib/compass/frameworks.rbc +66 -118
- data/lib/compass/quick_cache.rbc +8 -12
- data/lib/compass/sass_extensions.rbc +4 -8
- data/lib/compass/sass_extensions/functions.rbc +57 -90
- data/lib/compass/sass_extensions/functions/colors.rbc +18 -22
- data/lib/compass/sass_extensions/functions/constants.rbc +25 -45
- data/lib/compass/sass_extensions/functions/cross_browser_support.rbc +36 -48
- data/lib/compass/sass_extensions/functions/display.rbc +107 -341
- data/lib/compass/sass_extensions/functions/enumerate.rbc +9 -9
- data/lib/compass/sass_extensions/functions/font_files.rbc +125 -542
- data/lib/compass/sass_extensions/functions/gradient_support.rbc +167 -379
- data/lib/compass/sass_extensions/functions/image_size.rb +10 -2
- data/lib/compass/sass_extensions/functions/image_size.rbc +400 -715
- data/lib/compass/sass_extensions/functions/inline_image.rbc +98 -152
- data/lib/compass/sass_extensions/functions/lists.rb +0 -5
- data/lib/compass/sass_extensions/functions/lists.rbc +39 -75
- data/lib/compass/sass_extensions/functions/selectors.rbc +28 -36
- data/lib/compass/sass_extensions/functions/sprites.rb +5 -7
- data/lib/compass/sass_extensions/functions/sprites.rbc +233 -255
- data/lib/compass/sass_extensions/functions/trig.rb +2 -1
- data/lib/compass/sass_extensions/functions/trig.rbc +51 -53
- data/lib/compass/sass_extensions/functions/urls.rb +171 -80
- data/lib/compass/sass_extensions/functions/urls.rbc +1051 -3158
- data/lib/compass/sass_extensions/monkey_patches.rbc +5 -5
- data/lib/compass/sass_extensions/monkey_patches/browser_support.rbc +47 -63
- data/lib/compass/sass_extensions/monkey_patches/traversal.rbc +16 -36
- data/lib/compass/sass_extensions/sprites.rb +3 -1
- data/lib/compass/sass_extensions/sprites.rbc +13 -93
- data/lib/compass/sass_extensions/sprites/engines.rbc +6 -615
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rbc +94 -260
- data/lib/compass/sass_extensions/sprites/image.rb +23 -11
- data/lib/compass/sass_extensions/sprites/image.rbc +313 -691
- data/lib/compass/sass_extensions/sprites/image_row.rb +47 -0
- data/lib/compass/sass_extensions/sprites/layout_methods.rb +117 -0
- data/lib/compass/sass_extensions/sprites/row_fitter.rb +86 -0
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +18 -4
- data/lib/compass/sass_extensions/sprites/sprite_map.rbc +3635 -708
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +5 -17
- data/lib/compass/sprite_importer.rb +38 -62
- data/lib/compass/sprite_importer.rbc +1495 -1125
- data/lib/compass/util.rbc +11 -19
- data/lib/compass/version.rbc +25 -53
- data/test/fixtures/sprites/public/images/image_row/large.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/large_square.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/medium.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/small.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/tall.png +0 -0
- data/test/fixtures/stylesheets/compass/css/lists.css +7 -7
- data/test/fixtures/stylesheets/compass/css/reset.css +1 -0
- data/test/fixtures/stylesheets/compass/css/sprites.css +248 -248
- data/test/fixtures/stylesheets/compass/images/flag-s8c3c755a68.png +0 -0
- data/test/integrations/sprites_test.rb +115 -3
- data/test/test_helper.rb +29 -1
- data/test/tmp/compass_rails/public/images/selectors-sef52c5c63a.png +0 -0
- data/test/units/configuration_test.rb +2 -5
- data/test/units/rails_configuration_test.rb +50 -0
- data/test/units/sass_extensions_test.rb +17 -5
- data/test/units/sprites/image_row_test.rb +57 -0
- data/test/units/sprites/image_test.rb +53 -45
- data/test/units/sprites/importer_test.rb +31 -12
- data/test/units/sprites/row_fitter_test.rb +66 -0
- data/test/units/sprites/sprite_command_test.rb +1 -11
- data/test/units/sprites/sprite_map_test.rb +122 -16
- metadata +38 -149
- data/bin/compass.compiled.rbc +0 -707
- data/examples/compass/compass_app_log.txt +0 -6
- data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +0 -19
- data/lib/compass/commands.rbc +0 -307
- data/lib/compass/commands/base.rbc +0 -1044
- data/lib/compass/commands/clean_project.rbc +0 -1856
- data/lib/compass/commands/create_project.rbc +0 -2691
- data/lib/compass/commands/default.rbc +0 -1677
- data/lib/compass/commands/generate_grid_background.rbc +0 -1939
- data/lib/compass/commands/help.rbc +0 -1921
- data/lib/compass/commands/imports.rbc +0 -969
- data/lib/compass/commands/installer_command.rbc +0 -807
- data/lib/compass/commands/interactive.rbc +0 -1341
- data/lib/compass/commands/list_frameworks.rbc +0 -1111
- data/lib/compass/commands/print_version.rbc +0 -2478
- data/lib/compass/commands/project_base.rbc +0 -2085
- data/lib/compass/commands/project_stats.rbc +0 -4202
- data/lib/compass/commands/registry.rbc +0 -1350
- data/lib/compass/commands/sprite.rbc +0 -2212
- data/lib/compass/commands/stamp_pattern.rbc +0 -2011
- data/lib/compass/commands/unpack_extension.rbc +0 -2348
- data/lib/compass/commands/update_project.rbc +0 -3002
- data/lib/compass/commands/validate_project.rbc +0 -1686
- data/lib/compass/commands/watch_project.rbc +0 -4155
- data/lib/compass/commands/write_configuration.rbc +0 -2896
- data/lib/compass/exec.rbc +0 -500
- data/lib/compass/exec/command_option_parser.rbc +0 -676
- data/lib/compass/exec/global_options_parser.rbc +0 -1306
- data/lib/compass/exec/helpers.rbc +0 -758
- data/lib/compass/exec/project_options_parser.rbc +0 -1515
- data/lib/compass/exec/sub_command_ui.rbc +0 -1191
- data/lib/compass/grid_builder.rbc +0 -0
- data/lib/compass/installers.rbc +0 -152
- data/lib/compass/installers/bare_installer.rbc +0 -939
- data/lib/compass/installers/base.rbc +0 -4427
- data/lib/compass/installers/manifest.rbc +0 -3335
- data/lib/compass/installers/manifest_installer.rbc +0 -1591
- data/lib/compass/installers/template_context.rbc +0 -1030
- data/lib/compass/logger.rbc +0 -2317
- data/lib/compass/sass_extensions/functions/env.rbc +0 -299
- data/lib/compass/sass_extensions/sprites/image_methods.rbc +0 -900
- data/lib/compass/sass_extensions/sprites/image_row.rbc +0 -1168
- data/lib/compass/sass_extensions/sprites/layout_methods.rbc +0 -3236
- data/lib/compass/sass_extensions/sprites/row_fitter.rbc +0 -2067
- data/lib/compass/sass_extensions/sprites/sprite_methods.rbc +0 -3190
- data/test/fixtures/extensions/only_stylesheets/compass_init.rb +0 -1
- data/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss +0 -3
- data/test/fixtures/stylesheets/compass/css/user-interface.css +0 -5
- data/test/fixtures/stylesheets/compass/images/flag-s03c3b29b35.png +0 -0
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +0 -5
- data/test/fixtures/stylesheets/envtest/tmp/env.css +0 -2
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb +0 -25
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss +0 -5
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss +0 -3
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss +0 -6
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css +0 -5
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css +0 -3
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css +0 -68
- data/test/helpers/command_line.rbc +0 -2820
- data/test/helpers/diff.rbc +0 -1104
- data/test/helpers/io.rbc +0 -962
- data/test/helpers/rails.rbc +0 -1116
- data/test/helpers/test_case.rbc +0 -1255
- data/test/integrations/compass_test.rbc +0 -6589
- data/test/integrations/rails_integration_test.rbc +0 -1342
- data/test/integrations/sprites_test.rbc +0 -6192
- data/test/test_helper.rbc +0 -1694
- data/test/units/actions_test.rbc +0 -644
- data/test/units/command_line_test.rbc +0 -1532
- data/test/units/compass_png_test.rbc +0 -0
- data/test/units/configuration_test.rbc +0 -3833
- data/test/units/rails_configuration_test.rbc +0 -1032
- data/test/units/sass_extensions_test.rbc +0 -3586
- data/test/units/sprites/engine_test.rbc +0 -962
- data/test/units/sprites/image_row_test.rbc +0 -1578
- data/test/units/sprites/image_test.rbc +0 -2836
- data/test/units/sprites/importer_test.rbc +0 -2620
- data/test/units/sprites/row_fitter_test.rbc +0 -1479
- data/test/units/sprites/sprite_command_test.rbc +0 -1147
- 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
|
|
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
|
-
|
|
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
|
-
|
|
276
|
-
/Users/
|
|
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
|
-
|
|
338
|
-
/Users/
|
|
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
|
-
|
|
397
|
-
/Users/
|
|
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
|
-
|
|
456
|
-
/Users/
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
606
|
+
23
|
|
607
607
|
20
|
|
608
608
|
0
|
|
609
609
|
20
|
|
610
610
|
1
|
|
611
611
|
49
|
|
612
|
-
|
|
612
|
+
14
|
|
613
613
|
0
|
|
614
614
|
49
|
|
615
|
-
|
|
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
|
-
|
|
629
|
+
19
|
|
630
630
|
3
|
|
631
631
|
15
|
|
632
632
|
8
|
|
633
633
|
183
|
|
634
634
|
45
|
|
635
635
|
10
|
|
636
|
-
|
|
636
|
+
24
|
|
637
637
|
20
|
|
638
638
|
0
|
|
639
639
|
20
|
|
640
640
|
1
|
|
641
641
|
49
|
|
642
|
-
|
|
642
|
+
14
|
|
643
643
|
0
|
|
644
644
|
49
|
|
645
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
754
|
-
/Users/
|
|
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
|
-
|
|
793
|
-
/Users/
|
|
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
|
-
|
|
809
|
-
/Users/
|
|
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
|
-
|
|
15
|
-
|
|
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
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
52
|
-
|
|
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
|
-
|
|
61
|
-
|
|
53
|
+
if absolute_path?(path)
|
|
54
|
+
return Sass::Script::String.new("url(#{path})")
|
|
55
|
+
end
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
http_images_path =
|
|
81
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
if
|
|
92
|
-
|
|
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
|
-
|
|
167
|
+
Compass.configuration.http_root_relative(Compass.configuration.generated_images_dir)
|
|
95
168
|
end
|
|
96
|
-
end
|
|
97
169
|
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|