compass 0.12.0 → 0.12.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.markdown +18 -46
- data/Rakefile +34 -3
- data/bin/compass +2 -1
- data/features/command_line.feature +1 -0
- data/features/step_definitions/command_line_steps.rb +1 -1
- data/frameworks/compass/stylesheets/compass/_css3.scss +4 -0
- data/frameworks/compass/stylesheets/compass/_support.scss +4 -0
- data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +7 -3
- data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +4 -10
- data/frameworks/compass/stylesheets/compass/css3/_box.scss +2 -2
- data/frameworks/compass/stylesheets/compass/css3/_columns.scss +107 -10
- data/frameworks/compass/stylesheets/compass/css3/_filter.scss +23 -0
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +4 -4
- data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +77 -0
- data/frameworks/compass/stylesheets/compass/css3/_images.scss +2 -2
- data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +13 -7
- data/frameworks/compass/stylesheets/compass/css3/_regions.scss +22 -0
- data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +52 -13
- data/frameworks/compass/stylesheets/compass/css3/_transform.scss +20 -20
- data/frameworks/compass/stylesheets/compass/css3/_transition.scss +128 -61
- data/frameworks/compass/stylesheets/compass/reset/_utilities.scss +4 -2
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +69 -62
- data/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss +35 -9
- data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +1 -1
- data/lib/compass/actions.rb +6 -4
- data/lib/compass/commands.rb +4 -3
- data/lib/compass/commands/extension_command.rb +60 -0
- data/lib/compass/commands/project_base.rb +7 -1
- data/lib/compass/commands/update_project.rb +2 -2
- data/lib/compass/compiler.rb +1 -2
- data/lib/compass/configuration/adapters.rb +8 -2
- data/lib/compass/configuration/data.rb +1 -0
- data/lib/compass/exec/global_options_parser.rb +8 -1
- data/lib/compass/exec/project_options_parser.rb +8 -0
- data/lib/compass/sass_extensions/functions/colors.rb +14 -0
- data/lib/compass/sass_extensions/functions/constants.rb +9 -0
- data/lib/compass/sass_extensions/functions/font_files.rb +4 -2
- data/lib/compass/sass_extensions/functions/gradient_support.rb +11 -4
- data/lib/compass/sass_extensions/functions/math.rb +1 -1
- data/lib/compass/sass_extensions/functions/sprites.rb +10 -2
- data/lib/compass/sass_extensions/sprites/engines.rb +3 -3
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +8 -6
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +3 -2
- data/lib/compass/sprite_importer.rb +1 -1
- data/lib/compass/version.rb +15 -11
- data/test/fixtures/stylesheets/blueprint/css/screen.css +3 -4
- data/test/fixtures/stylesheets/blueprint/css/single-imports/buttons.css +6 -8
- data/test/fixtures/stylesheets/blueprint/css/single-imports/debug.css +1 -2
- data/test/fixtures/stylesheets/blueprint/css/single-imports/fancy-type.css +1 -1
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +8 -2
- data/test/fixtures/stylesheets/compass/css/border_radius.css +0 -6
- data/test/fixtures/stylesheets/compass/css/columns.css +126 -12
- data/test/fixtures/stylesheets/compass/css/filters.css +29 -0
- data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
- data/test/fixtures/stylesheets/compass/css/gradients.css +1 -25
- data/test/fixtures/stylesheets/compass/css/grid_background.css +7 -14
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +16 -0
- data/test/fixtures/stylesheets/compass/css/lists.css +6 -8
- data/test/fixtures/stylesheets/compass/css/pie.css +0 -1
- data/test/fixtures/stylesheets/compass/css/regions.css +7 -0
- data/test/fixtures/stylesheets/compass/css/replacement.css +59 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +2 -2
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +22 -4
- data/test/fixtures/stylesheets/compass/css/transform.css +108 -0
- data/test/fixtures/stylesheets/compass/css/transition.css +67 -10
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +25 -25
- data/test/fixtures/stylesheets/compass/sass/columns.scss +19 -0
- data/test/fixtures/stylesheets/compass/sass/filters.scss +24 -0
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +2 -4
- data/test/fixtures/stylesheets/compass/sass/hyphenation.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/regions.scss +4 -0
- data/test/fixtures/stylesheets/compass/sass/replacement.scss +22 -0
- data/test/fixtures/stylesheets/compass/sass/text_shadow.scss +6 -1
- data/test/fixtures/stylesheets/compass/sass/transition.scss +12 -0
- data/test/helpers/test_case.rb +8 -1
- data/test/integrations/sprites_test.rb +5 -5
- data/test/test_helper.rb +2 -1
- data/test/units/compass_module_test.rb +1 -1
- data/test/units/configuration_test.rb +15 -0
- data/test/units/regressions_test.rb +35 -0
- data/test/units/sass_extensions_test.rb +33 -11
- metadata +62 -222
- data/VERSION.yml +0 -5
- data/bin/compass.compiled.rbc +0 -707
- data/examples/compass/images/emblem-a043c4f148.png +0 -0
- data/examples/compass/images/flag-03c3b29b35.png +0 -0
- data/examples/compass/images/flag-21cfbfbfc8.png +0 -0
- data/examples/css3/extensions/fancy-fonts/templates/project/Prociono.otf +0 -0
- data/examples/css3/extensions/fancy-fonts/templates/project/bgrove.otf +0 -0
- data/examples/css3/extensions/fancy-fonts/templates/project/bgrove.ttf +0 -0
- data/lib/compass.rbc +0 -796
- data/lib/compass/actions.rbc +0 -2736
- data/lib/compass/app_integration.rbc +0 -836
- data/lib/compass/app_integration/merb.rbc +0 -106
- data/lib/compass/app_integration/rails.rbc +0 -2096
- data/lib/compass/app_integration/rails/configuration_defaults.rbc +0 -2430
- data/lib/compass/app_integration/rails/installer.rbc +0 -3677
- data/lib/compass/app_integration/stand_alone.rbc +0 -589
- data/lib/compass/app_integration/stand_alone/configuration_defaults.rbc +0 -721
- data/lib/compass/app_integration/stand_alone/installer.rbc +0 -1487
- data/lib/compass/browser_support.rbc +0 -1144
- 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/compiler.rbc +0 -4913
- data/lib/compass/configuration.rbc +0 -1398
- data/lib/compass/configuration/adapters.rbc +0 -2088
- data/lib/compass/configuration/comments.rbc +0 -843
- data/lib/compass/configuration/data.rbc +0 -2633
- data/lib/compass/configuration/defaults.rbc +0 -3617
- data/lib/compass/configuration/file_data.rbc +0 -643
- data/lib/compass/configuration/helpers.rbc +0 -3500
- data/lib/compass/configuration/inheritance.rbc +0 -3592
- data/lib/compass/configuration/paths.rbc +0 -412
- data/lib/compass/configuration/serialization.rbc +0 -1996
- data/lib/compass/dependencies.rbc +0 -232
- data/lib/compass/errors.rbc +0 -176
- 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/frameworks.rbc +0 -3640
- 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/quick_cache.rbc +0 -324
- data/lib/compass/sass_extensions.rbc +0 -213
- data/lib/compass/sass_extensions/functions.rbc +0 -808
- data/lib/compass/sass_extensions/functions/colors.rbc +0 -1279
- data/lib/compass/sass_extensions/functions/constants.rbc +0 -1921
- data/lib/compass/sass_extensions/functions/cross_browser_support.rbc +0 -1966
- data/lib/compass/sass_extensions/functions/display.rbc +0 -1227
- data/lib/compass/sass_extensions/functions/enumerate.rbc +0 -446
- data/lib/compass/sass_extensions/functions/env.rbc +0 -299
- data/lib/compass/sass_extensions/functions/font_files.rbc +0 -821
- data/lib/compass/sass_extensions/functions/gradient_support.rbc +0 -14147
- data/lib/compass/sass_extensions/functions/image_size.rbc +0 -3152
- data/lib/compass/sass_extensions/functions/inline_image.rbc +0 -1678
- data/lib/compass/sass_extensions/functions/lists.rbc +0 -2601
- data/lib/compass/sass_extensions/functions/selectors.rbc +0 -1592
- data/lib/compass/sass_extensions/functions/sprites.rbc +0 -3792
- data/lib/compass/sass_extensions/functions/trig.rbc +0 -811
- data/lib/compass/sass_extensions/functions/urls.rbc +0 -5248
- data/lib/compass/sass_extensions/monkey_patches.rbc +0 -134
- data/lib/compass/sass_extensions/monkey_patches/browser_support.rbc +0 -2169
- data/lib/compass/sass_extensions/monkey_patches/traversal.rbc +0 -660
- data/lib/compass/sass_extensions/sprites.rbc +0 -363
- data/lib/compass/sass_extensions/sprites/base.rbc +0 -4529
- data/lib/compass/sass_extensions/sprites/engines.rbc +0 -662
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rbc +0 -1074
- data/lib/compass/sass_extensions/sprites/image.rbc +0 -2961
- 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_map.rbc +0 -1991
- data/lib/compass/sass_extensions/sprites/sprite_methods.rbc +0 -3190
- data/lib/compass/sass_extensions/sprites/sprites.rbc +0 -1573
- data/lib/compass/sprite_importer.rbc +0 -3573
- data/lib/compass/util.rbc +0 -552
- data/lib/compass/version.rbc +0 -1245
- data/test/fixtures/stylesheets/busted_image_urls/tmp/screen.css +0 -9
- data/test/fixtures/stylesheets/envtest/tmp/env.css +0 -2
- 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
@@ -17,7 +17,9 @@
|
|
17
17
|
time, mark, audio, video {
|
18
18
|
@include reset-box-model;
|
19
19
|
@include reset-font; }
|
20
|
-
|
20
|
+
// Unlike Eric's original reset, we reset the html element to be compatible
|
21
|
+
// with the vertical rhythm mixins.
|
22
|
+
html {
|
21
23
|
@include reset-body; }
|
22
24
|
ol, ul {
|
23
25
|
@include reset-list-style; }
|
@@ -67,8 +69,8 @@
|
|
67
69
|
|
68
70
|
// Reset the font and vertical alignment.
|
69
71
|
@mixin reset-font {
|
70
|
-
font-size: 100%;
|
71
72
|
font: inherit;
|
73
|
+
font-size: 100%;
|
72
74
|
vertical-align: baseline; }
|
73
75
|
|
74
76
|
// Resets the outline when focus.
|
@@ -1,18 +1,18 @@
|
|
1
1
|
@import "compass/layout/grid-background";
|
2
2
|
|
3
|
-
// The base font size
|
3
|
+
// The base font size.
|
4
4
|
$base-font-size: 16px !default;
|
5
5
|
|
6
|
-
// The base line height
|
6
|
+
// The base line height determines the basic unit of vertical rhythm.
|
7
7
|
$base-line-height: 24px !default;
|
8
8
|
|
9
|
-
//
|
9
|
+
// Set the default border style for rhythm borders.
|
10
10
|
$default-rhythm-border-style: solid !default;
|
11
11
|
|
12
|
-
// The
|
13
|
-
$
|
12
|
+
// The default font size in all browsers.
|
13
|
+
$browser-default-font-size: 16px;
|
14
14
|
|
15
|
-
// Set to false if you want to use absolute
|
15
|
+
// Set to false if you want to use absolute pixels in sizing your typography.
|
16
16
|
$relative-font-sizing: true !default;
|
17
17
|
|
18
18
|
// Allows the `adjust-font-size-to` mixin and the `lines-for-font-size` function
|
@@ -25,26 +25,26 @@ $round-to-nearest-half-line: false !default;
|
|
25
25
|
$min-line-padding: 2px !default;
|
26
26
|
|
27
27
|
// $base-font-size but in your output unit of choice.
|
28
|
-
// Defaults to 1em when `$relative-font-sizing`
|
28
|
+
// Defaults to 1em when `$relative-font-sizing` is true.
|
29
29
|
$font-unit: if($relative-font-sizing, 1em, $base-font-size) !default;
|
30
30
|
|
31
|
-
// The basic unit of font rhythm
|
31
|
+
// The basic unit of font rhythm.
|
32
32
|
$base-rhythm-unit: $base-line-height / $base-font-size * $font-unit;
|
33
33
|
|
34
34
|
// The leader is the amount of whitespace in a line.
|
35
|
-
// It might be useful in your calculations
|
35
|
+
// It might be useful in your calculations.
|
36
36
|
$base-leader: ($base-line-height - $base-font-size) * $font-unit / $base-font-size;
|
37
37
|
|
38
38
|
// The half-leader is the amount of whitespace above and below a line.
|
39
|
-
// It might be useful in your calculations
|
39
|
+
// It might be useful in your calculations.
|
40
40
|
$base-half-leader: $base-leader / 2;
|
41
41
|
|
42
|
-
// True if a number has a relative unit
|
42
|
+
// True if a number has a relative unit.
|
43
43
|
@function relative-unit($number) {
|
44
44
|
@return unit($number) == "%" or unit($number) == "em" or unit($number) == "rem"
|
45
45
|
}
|
46
46
|
|
47
|
-
// True if a number has an absolute unit
|
47
|
+
// True if a number has an absolute unit.
|
48
48
|
@function absolute-unit($number) {
|
49
49
|
@return not (relative-unit($number) or unitless($number));
|
50
50
|
}
|
@@ -53,24 +53,31 @@ $base-half-leader: $base-leader / 2;
|
|
53
53
|
@warn "$relative-font-sizing is true but $font-unit is set to #{$font-unit} which is not a relative unit.";
|
54
54
|
}
|
55
55
|
|
56
|
-
// Establishes a font baseline for the given font-size
|
56
|
+
// Establishes a font baseline for the given font-size.
|
57
57
|
@mixin establish-baseline($font-size: $base-font-size) {
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
// IE 6 refuses to resize fonts set in pixels and it weirdly resizes fonts
|
59
|
+
// whose root is set in ems. So we set the root font size in percentages of
|
60
|
+
// the default font size.
|
61
|
+
* html {
|
62
|
+
font-size: 100% * ($font-size / $browser-default-font-size);
|
61
63
|
}
|
62
|
-
html
|
64
|
+
html {
|
63
65
|
font-size: $font-size;
|
66
|
+
@include adjust-leading-to(1, if($relative-font-sizing, $font-size, $base-font-size));
|
64
67
|
}
|
65
68
|
}
|
66
69
|
|
67
|
-
//
|
70
|
+
// Resets the line-height to 1 vertical rhythm unit.
|
71
|
+
// Does not work on elements whose font-size is different from $base-font-size.
|
72
|
+
//
|
73
|
+
// @deprecated This mixin will be removed in the next release.
|
74
|
+
// Please use the `adjust-leading-to` mixin instead.
|
68
75
|
@mixin reset-baseline {
|
69
76
|
@include adjust-leading-to(1, if($relative-font-sizing, $base-font-size, $base-font-size));
|
70
77
|
}
|
71
78
|
|
72
79
|
// Show a background image that can be used to debug your alignments.
|
73
|
-
//
|
80
|
+
// Include the $img argument if you would rather use your own image than the
|
74
81
|
// Compass default gradient image.
|
75
82
|
@mixin debug-vertical-alignment($img: false) {
|
76
83
|
@if $img {
|
@@ -80,11 +87,11 @@ $base-half-leader: $base-leader / 2;
|
|
80
87
|
}
|
81
88
|
}
|
82
89
|
|
83
|
-
// Adjust a block to have a different font size and
|
84
|
-
// $lines
|
85
|
-
// font
|
86
|
-
// to the smallest integer that is large enough to fit the font.
|
87
|
-
// Use $
|
90
|
+
// Adjust a block to have a different font size and line height to maintain the
|
91
|
+
// rhythm. $lines specifies how many multiples of the baseline rhythm each line
|
92
|
+
// of this font should use up. It does not have to be an integer, but it
|
93
|
+
// defaults to the smallest integer that is large enough to fit the font.
|
94
|
+
// Use $from-size to adjust from a font-size other than the base font-size.
|
88
95
|
@mixin adjust-font-size-to($to-size, $lines: lines-for-font-size($to-size), $from-size: $base-font-size) {
|
89
96
|
@if not $relative-font-sizing and $from-size != $base-font-size {
|
90
97
|
@warn "$relative-font-sizing is false but a relative font size was passed to adjust-font-size-to";
|
@@ -93,25 +100,32 @@ $base-half-leader: $base-leader / 2;
|
|
93
100
|
@include adjust-leading-to($lines, if($relative-font-sizing, $to-size, $base-font-size));
|
94
101
|
}
|
95
102
|
|
103
|
+
// Adjust a block to have different line height to maintain the rhythm.
|
104
|
+
// $lines specifies how many multiples of the baseline rhythm each line of this
|
105
|
+
// font should use up. It does not have to be an integer, but it defaults to the
|
106
|
+
// smallest integer that is large enough to fit the font.
|
96
107
|
@mixin adjust-leading-to($lines, $font-size: $base-font-size) {
|
97
|
-
|
98
|
-
@warn "$relative-font-sizing is false but a relative font size was passed to adjust-leading-to";
|
99
|
-
}
|
100
|
-
line-height: $font-unit * $lines * $base-line-height / $font-size;
|
108
|
+
line-height: rhythm($lines, $font-size);
|
101
109
|
}
|
102
110
|
|
103
|
-
// Calculate rhythm units
|
111
|
+
// Calculate rhythm units.
|
104
112
|
@function rhythm(
|
105
113
|
$lines: 1,
|
106
|
-
$font-size: $base-font-size
|
114
|
+
$font-size: $base-font-size,
|
115
|
+
$offset: 0
|
107
116
|
) {
|
108
117
|
@if not $relative-font-sizing and $font-size != $base-font-size {
|
109
118
|
@warn "$relative-font-sizing is false but a relative font size was passed to the rhythm function";
|
110
119
|
}
|
111
|
-
$rhythm: $font-unit * $lines * $base-line-height / $font-size;
|
120
|
+
$rhythm: $font-unit * ($lines * $base-line-height - $offset) / $font-size;
|
121
|
+
// Round the pixels down to nearest integer.
|
122
|
+
@if unit($rhythm) == px {
|
123
|
+
$rhythm: floor($rhythm);
|
124
|
+
}
|
112
125
|
@return $rhythm;
|
113
126
|
}
|
114
127
|
|
128
|
+
// Calculate the minimum multiple of rhythm units needed to contain the font-size.
|
115
129
|
@function lines-for-font-size($font-size) {
|
116
130
|
$lines: if($round-to-nearest-half-line,
|
117
131
|
ceil(2 * $font-size / $base-line-height) / 2,
|
@@ -122,46 +136,37 @@ $base-half-leader: $base-leader / 2;
|
|
122
136
|
@return $lines;
|
123
137
|
}
|
124
138
|
|
125
|
-
// Apply leading whitespace
|
139
|
+
// Apply leading whitespace. The $property can be margin or padding.
|
126
140
|
@mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) {
|
127
|
-
$
|
128
|
-
@if unit($leader) == px {
|
129
|
-
$leader: floor($leader)
|
130
|
-
}
|
131
|
-
#{$property}-top: $leader;
|
141
|
+
#{$property}-top: rhythm($lines, $font-size);
|
132
142
|
}
|
133
143
|
|
134
|
-
// Apply leading whitespace as padding
|
144
|
+
// Apply leading whitespace as padding.
|
135
145
|
@mixin padding-leader($lines: 1, $font-size: $base-font-size) {
|
136
|
-
|
146
|
+
padding-top: rhythm($lines, $font-size);
|
137
147
|
}
|
138
148
|
|
139
|
-
// Apply leading whitespace as margin
|
149
|
+
// Apply leading whitespace as margin.
|
140
150
|
@mixin margin-leader($lines: 1, $font-size: $base-font-size) {
|
141
|
-
|
151
|
+
margin-top: rhythm($lines, $font-size);
|
142
152
|
}
|
143
153
|
|
144
|
-
// Apply trailing whitespace
|
154
|
+
// Apply trailing whitespace. The $property can be margin or padding.
|
145
155
|
@mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) {
|
146
|
-
$
|
147
|
-
@if unit($leader) == px {
|
148
|
-
$leader: ceil($leader)
|
149
|
-
}
|
150
|
-
#{$property}-bottom: $leader;
|
156
|
+
#{$property}-bottom: rhythm($lines, $font-size);
|
151
157
|
}
|
152
158
|
|
153
|
-
// Apply trailing whitespace as padding
|
159
|
+
// Apply trailing whitespace as padding.
|
154
160
|
@mixin padding-trailer($lines: 1, $font-size: $base-font-size) {
|
155
|
-
|
161
|
+
padding-bottom: rhythm($lines, $font-size);
|
156
162
|
}
|
157
163
|
|
158
|
-
// Apply trailing whitespace as margin
|
164
|
+
// Apply trailing whitespace as margin.
|
159
165
|
@mixin margin-trailer($lines: 1, $font-size: $base-font-size) {
|
160
|
-
|
166
|
+
margin-bottom: rhythm($lines, $font-size);
|
161
167
|
}
|
162
168
|
|
163
|
-
//
|
164
|
-
// Apply top margin/padding + bottom padding/margin
|
169
|
+
// Shorthand mixin to apply whitespace for top and bottom margins and padding.
|
165
170
|
@mixin rhythm($leader: 0, $padding-leader: 0, $padding-trailer: 0, $trailer: 0, $font-size: $base-font-size) {
|
166
171
|
@include leader($leader, $font-size);
|
167
172
|
@include padding-leader($padding-leader, $font-size);
|
@@ -169,8 +174,8 @@ $base-half-leader: $base-leader / 2;
|
|
169
174
|
@include trailer($trailer, $font-size);
|
170
175
|
}
|
171
176
|
|
172
|
-
// Apply a border
|
173
|
-
// The
|
177
|
+
// Apply a border and whitespace to any side without destroying the vertical
|
178
|
+
// rhythm. The whitespace must be greater than the width of the border.
|
174
179
|
@mixin apply-side-rhythm-border($side, $width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
175
180
|
@if not $relative-font-sizing and $font-size != $base-font-size {
|
176
181
|
@warn "$relative-font-sizing is false but a relative font size was passed to apply-side-rhythm-border";
|
@@ -179,36 +184,38 @@ $base-half-leader: $base-leader / 2;
|
|
179
184
|
style: $border-style;
|
180
185
|
width: $font-unit * $width / $font-size;
|
181
186
|
};
|
182
|
-
padding-#{$side}: $
|
187
|
+
padding-#{$side}: rhythm($lines, $font-size, $offset: $width);
|
183
188
|
}
|
184
189
|
|
185
|
-
//
|
190
|
+
// Apply borders and whitespace equally to all sides.
|
186
191
|
@mixin rhythm-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
187
192
|
@if not $relative-font-sizing and $font-size != $base-font-size {
|
188
193
|
@warn "$relative-font-sizing is false but a relative font size was passed to rhythm-borders";
|
189
194
|
}
|
190
195
|
border: {
|
191
196
|
style: $border-style;
|
192
|
-
width: $font-unit * $width / $font-size;
|
193
|
-
|
197
|
+
width: $font-unit * $width / $font-size;
|
198
|
+
};
|
199
|
+
padding: rhythm($lines, $font-size, $offset: $width);
|
194
200
|
}
|
195
201
|
|
196
|
-
// Apply a leading
|
202
|
+
// Apply a leading border.
|
197
203
|
@mixin leading-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
198
204
|
@include apply-side-rhythm-border(top, $width, $lines, $font-size, $border-style);
|
199
205
|
}
|
200
206
|
|
201
|
-
// Apply a trailing
|
207
|
+
// Apply a trailing border.
|
202
208
|
@mixin trailing-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
203
209
|
@include apply-side-rhythm-border(bottom, $width, $lines, $font-size, $border-style);
|
204
210
|
}
|
205
211
|
|
206
|
-
// Apply both leading and trailing
|
212
|
+
// Apply both leading and trailing borders.
|
207
213
|
@mixin horizontal-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
208
214
|
@include leading-border($width, $lines, $font-size, $border-style);
|
209
215
|
@include trailing-border($width, $lines, $font-size, $border-style);
|
210
216
|
}
|
211
217
|
|
218
|
+
// Alias for `horizontal-borders` mixin.
|
212
219
|
@mixin h-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
213
220
|
@include horizontal-borders($width, $lines, $font-size, $border-style);
|
214
221
|
}
|
@@ -1,16 +1,27 @@
|
|
1
|
+
// Indicates the direction you prefer to move your text
|
2
|
+
// when hiding it.
|
3
|
+
//
|
4
|
+
// `left` is more robust, especially in older browsers.
|
5
|
+
// `right` seems have better runtime performance.
|
6
|
+
$hide-text-direction: left !default;
|
7
|
+
|
1
8
|
// Hides html text and replaces it with an image.
|
2
9
|
// If you use this on an inline element, you will need to change the display to block or inline-block.
|
3
10
|
// Also, if the size of the image differs significantly from the font size, you'll need to set the width and/or height.
|
4
11
|
//
|
5
12
|
// Parameters:
|
6
13
|
//
|
7
|
-
// * `img` -- the relative path from the project image directory to the image.
|
14
|
+
// * `img` -- the relative path from the project image directory to the image, or a url literal.
|
8
15
|
// * `x` -- the x position of the background image.
|
9
16
|
// * `y` -- the y position of the background image.
|
10
17
|
@mixin replace-text($img, $x: 50%, $y: 50%) {
|
11
18
|
@include hide-text;
|
12
19
|
background: {
|
13
|
-
|
20
|
+
@if is-url($img) {
|
21
|
+
image: $img;
|
22
|
+
} @else {
|
23
|
+
image: image-url($img);
|
24
|
+
}
|
14
25
|
repeat: no-repeat;
|
15
26
|
position: $x $y;
|
16
27
|
};
|
@@ -18,18 +29,33 @@
|
|
18
29
|
|
19
30
|
// Like the `replace-text` mixin, but also sets the width
|
20
31
|
// and height of the element according the dimensions of the image.
|
21
|
-
|
22
|
-
|
32
|
+
//
|
33
|
+
// If you set `$inline` to true, then an inline image (data uri) will be used.
|
34
|
+
@mixin replace-text-with-dimensions($img, $x: 50%, $y: 50%, $inline: false) {
|
35
|
+
@include replace-text(if($inline, inline-image($img), $img), $x, $y);
|
23
36
|
width: image-width($img);
|
24
37
|
height: image-height($img);
|
25
38
|
}
|
26
39
|
|
27
40
|
// Hides text in an element so you can see the background.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
41
|
+
//
|
42
|
+
// The direction indicates how the text should be moved out of view.
|
43
|
+
//
|
44
|
+
// See `$hide-text-direction` for more information and to set this globally
|
45
|
+
// for your application.
|
46
|
+
@mixin hide-text($direction: $hide-text-direction) {
|
47
|
+
@if $direction == left {
|
48
|
+
$approximate-em-value: 12px / 1em;
|
49
|
+
$wider-than-any-screen: -9999em;
|
50
|
+
text-indent: $wider-than-any-screen * $approximate-em-value;
|
51
|
+
overflow: hidden;
|
52
|
+
text-align: left;
|
53
|
+
} @else {
|
54
|
+
// slightly wider than the box prevents issues with inline-block elements
|
55
|
+
text-indent: 110%;
|
56
|
+
white-space: nowrap;
|
57
|
+
overflow: hidden;
|
58
|
+
}
|
33
59
|
}
|
34
60
|
|
35
61
|
// Hides text in an element by squishing the text into oblivion.
|
data/lib/compass/actions.rb
CHANGED
@@ -10,7 +10,11 @@ module Compass
|
|
10
10
|
# copy/process a template in the compass template directory to the project directory.
|
11
11
|
def copy(from, to, options = nil, binary = false)
|
12
12
|
options ||= self.options if self.respond_to?(:options)
|
13
|
-
|
13
|
+
if binary
|
14
|
+
contents = File.new(from,"rb").read
|
15
|
+
else
|
16
|
+
contents = File.new(from).read
|
17
|
+
end
|
14
18
|
write_file to, contents, options, binary
|
15
19
|
end
|
16
20
|
|
@@ -51,9 +55,7 @@ module Compass
|
|
51
55
|
if skip_write
|
52
56
|
FileUtils.touch file_name unless options[:dry_run]
|
53
57
|
else
|
54
|
-
|
55
|
-
mode << "b" if binary
|
56
|
-
open(file_name, mode) do |file|
|
58
|
+
Sass::Util.atomic_create_and_write_file(file_name) do |file|
|
57
59
|
file.write(contents)
|
58
60
|
end
|
59
61
|
end
|
data/lib/compass/commands.rb
CHANGED
@@ -4,8 +4,9 @@ end
|
|
4
4
|
require 'compass/commands/registry'
|
5
5
|
|
6
6
|
%w(base generate_grid_background default help list_frameworks project_base
|
7
|
-
update_project watch_project create_project clean_project
|
8
|
-
print_version project_stats stamp_pattern
|
9
|
-
write_configuration interactive unpack_extension
|
7
|
+
update_project watch_project create_project clean_project extension_command
|
8
|
+
imports installer_command print_version project_stats stamp_pattern
|
9
|
+
sprite validate_project write_configuration interactive unpack_extension
|
10
|
+
).each do |lib|
|
10
11
|
require "compass/commands/#{lib}"
|
11
12
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'compass/commands/base'
|
3
|
+
|
4
|
+
module Compass
|
5
|
+
module Commands
|
6
|
+
module ExtensionsOptionParser
|
7
|
+
def set_options(opts)
|
8
|
+
opts.banner = %Q{
|
9
|
+
Usage: compass extension install EXTENSION_NAME [options]
|
10
|
+
compass extension uninstall EXTENSION_NAME [options]
|
11
|
+
compass extension list
|
12
|
+
|
13
|
+
Description:
|
14
|
+
Manage the list of extensions on your system.
|
15
|
+
Compass to all of your compass projects.
|
16
|
+
|
17
|
+
Example:
|
18
|
+
compass extension install sassy-buttons
|
19
|
+
compass extension uninstall sassy-buttons
|
20
|
+
|
21
|
+
}
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class ExtensionCommand < Base
|
27
|
+
|
28
|
+
register :extension
|
29
|
+
|
30
|
+
class << self
|
31
|
+
def option_parser(arguments)
|
32
|
+
parser = Compass::Exec::CommandOptionParser.new(arguments)
|
33
|
+
parser.extend(ExtensionsOptionParser)
|
34
|
+
end
|
35
|
+
def usage
|
36
|
+
option_parser([]).to_s
|
37
|
+
end
|
38
|
+
def description(command)
|
39
|
+
"Manage the list of compass extensions on your system"
|
40
|
+
end
|
41
|
+
def parse!(arguments)
|
42
|
+
{:arguments => arguments}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
include InstallerCommand
|
46
|
+
|
47
|
+
def initialize(working_path, options)
|
48
|
+
super(working_path, options)
|
49
|
+
end
|
50
|
+
|
51
|
+
# all commands must implement perform
|
52
|
+
def perform
|
53
|
+
require 'rubygems/gem_runner'
|
54
|
+
Gem::GemRunner.new.run(options[:arguments])
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|