compass 0.11.beta.2 → 0.11.beta.3
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/VERSION.yml +1 -1
- data/examples/compass/src/utilities.scss +2 -2
- data/features/step_definitions/command_line_steps.rb +1 -1
- data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +1 -1
- data/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +1 -1
- data/frameworks/compass/stylesheets/_compass.scss +1 -0
- data/frameworks/compass/stylesheets/compass/_css3.scss +1 -0
- data/frameworks/compass/stylesheets/compass/_reset-legacy.scss +3 -0
- data/frameworks/compass/stylesheets/compass/_typography.scss +4 -0
- data/frameworks/compass/stylesheets/compass/_utilities.scss +6 -3
- data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +13 -0
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +10 -10
- data/frameworks/compass/stylesheets/compass/reset/_utilities-legacy.scss +135 -0
- data/frameworks/compass/stylesheets/compass/reset/_utilities.scss +34 -28
- data/frameworks/compass/stylesheets/compass/typography/_links.scss +3 -0
- data/frameworks/compass/stylesheets/compass/typography/_lists.scss +4 -0
- data/frameworks/compass/stylesheets/compass/typography/_text.scss +3 -0
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +124 -0
- data/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss +5 -0
- data/frameworks/compass/stylesheets/compass/typography/links/_link-colors.scss +28 -0
- data/frameworks/compass/stylesheets/compass/typography/links/_unstyled-link.scss +7 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss +34 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +61 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss +47 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +44 -0
- data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +25 -0
- data/frameworks/compass/stylesheets/compass/typography/text/_nowrap.scss +2 -0
- data/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss +34 -0
- data/frameworks/compass/stylesheets/compass/utilities/_color.scss +1 -0
- data/frameworks/compass/stylesheets/compass/utilities/_links.scss +5 -3
- data/frameworks/compass/stylesheets/compass/utilities/_lists.scss +6 -4
- data/frameworks/compass/stylesheets/compass/utilities/_text.scss +5 -3
- data/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss +28 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +3 -5
- data/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +2 -27
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +3 -7
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +2 -33
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +2 -60
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +2 -46
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +2 -34
- data/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +2 -24
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +3 -2
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +2 -33
- data/frameworks/compass/templates/ellipsis/ellipsis.sass +1 -1
- data/frameworks/compass/templates/pie/manifest.rb +1 -1
- data/lib/compass.rb +2 -0
- data/lib/compass/compiler.rb +18 -4
- data/lib/compass/configuration.rb +1 -1
- data/lib/compass/configuration/data.rb +10 -0
- data/lib/compass/configuration/file_data.rb +43 -0
- data/lib/compass/configuration/helpers.rb +8 -2
- data/lib/compass/configuration/inheritance.rb +2 -2
- data/lib/compass/configuration/serialization.rb +51 -76
- data/lib/compass/sass_extensions/functions/colors.rb +1 -1
- data/lib/compass/sass_extensions/functions/sprites.rb +9 -5
- data/test/compass_test.rb +35 -7
- data/test/fixtures/stylesheets/blueprint/css/screen.css +18 -14
- data/test/fixtures/stylesheets/compass/css/fonts.css +2 -6
- data/test/fixtures/stylesheets/compass/css/lists.css +0 -6
- data/test/fixtures/stylesheets/compass/css/reset.css +18 -14
- data/test/fixtures/stylesheets/compass/css/utilities.css +13 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +42 -0
- data/test/fixtures/stylesheets/compass/sass/fonts.sass +1 -1
- data/test/fixtures/stylesheets/compass/sass/lists.scss +2 -2
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +14 -0
- metadata +30 -31
@@ -1,61 +1,3 @@
|
|
1
|
-
|
2
|
-
//
|
3
|
-
// Easy mode using simple descendant li selectors:
|
4
|
-
//
|
5
|
-
// ul.nav
|
6
|
-
// +horizontal-list
|
7
|
-
//
|
8
|
-
// Advanced mode:
|
9
|
-
// If you need to target the list items using a different selector then use
|
10
|
-
// +horizontal-list-container on your ul/ol and +horizontal-list-item on your li.
|
11
|
-
// This may help when working on layouts involving nested lists. For example:
|
12
|
-
//
|
13
|
-
// ul.nav
|
14
|
-
// +horizontal-list-container
|
15
|
-
// > li
|
16
|
-
// +horizontal-list-item
|
1
|
+
@warn "This import is deprecated. Use 'compass/typography/lists/horizontal-list' instead.";
|
17
2
|
|
18
|
-
@import "
|
19
|
-
@import "compass/utilities/general/clearfix";
|
20
|
-
@import "compass/utilities/general/reset";
|
21
|
-
@import "compass/utilities/general/float";
|
22
|
-
|
23
|
-
// Can be mixed into any selector that target a ul or ol that is meant
|
24
|
-
// to have a horizontal layout. Used to implement +horizontal-list.
|
25
|
-
@mixin horizontal-list-container {
|
26
|
-
@include reset-box-model;
|
27
|
-
@include clearfix; }
|
28
|
-
|
29
|
-
// Can be mixed into any li selector that is meant to participate in a horizontal layout.
|
30
|
-
// Used to implement +horizontal-list.
|
31
|
-
//
|
32
|
-
// :last-child is not fully supported
|
33
|
-
// see http://www.quirksmode.org/css/contents.html#t29 for the support matrix
|
34
|
-
//
|
35
|
-
// IE8 ignores rules that are included on the same line as :last-child
|
36
|
-
// see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details
|
37
|
-
//
|
38
|
-
// Setting `$padding` to `false` disables the padding between list elements
|
39
|
-
@mixin horizontal-list-item($padding: 4px, $direction: left) {
|
40
|
-
@include no-bullet;
|
41
|
-
white-space: nowrap;
|
42
|
-
@include float($direction);
|
43
|
-
@if $padding {
|
44
|
-
padding: {
|
45
|
-
left: $padding;
|
46
|
-
right: $padding;
|
47
|
-
}
|
48
|
-
&:first-child, &.first { padding-#{$direction}: 0; }
|
49
|
-
&:last-child { padding-#{opposite-position($direction)}: 0; }
|
50
|
-
&.last { padding-#{opposite-position($direction)}: 0; }
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
// A list(ol,ul) that is layed out such that the elements are floated left and won't wrap.
|
55
|
-
// This is not an inline list.
|
56
|
-
//
|
57
|
-
// Setting `$padding` to `false` disables the padding between list elements
|
58
|
-
@mixin horizontal-list($padding: 4px, $direction: left) {
|
59
|
-
@include horizontal-list-container;
|
60
|
-
li {
|
61
|
-
@include horizontal-list-item($padding, $direction); } }
|
3
|
+
@import "../../typography/lists/horizontal-list";
|
@@ -1,47 +1,3 @@
|
|
1
|
-
|
2
|
-
//
|
3
|
-
// Easy mode using simple descendant li selectors:
|
4
|
-
//
|
5
|
-
// ul.nav
|
6
|
-
// +inline-block-list
|
7
|
-
//
|
8
|
-
// Advanced mode:
|
9
|
-
// If you need to target the list items using a different selector then use
|
10
|
-
// +inline-block-list-container on your ul/ol and +inline-block-list-item on your li.
|
11
|
-
// This may help when working on layouts involving nested lists. For example:
|
12
|
-
//
|
13
|
-
// ul.nav
|
14
|
-
// +inline-block-list-container
|
15
|
-
// > li
|
16
|
-
// +inline-block-list-item
|
1
|
+
@warn "This import is deprecated. Use 'compass/typography/lists/inline-block-list' instead.";
|
17
2
|
|
18
|
-
@import "
|
19
|
-
@import "horizontal-list";
|
20
|
-
@import "compass/utilities/general/float";
|
21
|
-
@import "compass/css3/inline-block";
|
22
|
-
|
23
|
-
// Can be mixed into any selector that target a ul or ol that is meant
|
24
|
-
// to have an inline-block layout. Used to implement +inline-block-list.
|
25
|
-
@mixin inline-block-list-container {
|
26
|
-
@include horizontal-list-container; }
|
27
|
-
|
28
|
-
// Can be mixed into any li selector that is meant to participate in a horizontal layout.
|
29
|
-
// Used to implement +inline-block-list.
|
30
|
-
|
31
|
-
@mixin inline-block-list-item($padding: false) {
|
32
|
-
@include no-bullet;
|
33
|
-
@include inline-block;
|
34
|
-
white-space: nowrap;
|
35
|
-
@if $padding {
|
36
|
-
padding: {
|
37
|
-
left: $padding;
|
38
|
-
right: $padding;
|
39
|
-
};
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
// A list(ol,ul) that is layed out such that the elements are inline-block and won't wrap.
|
44
|
-
@mixin inline-block-list($padding: false) {
|
45
|
-
@include inline-block-list-container;
|
46
|
-
li {
|
47
|
-
@include inline-block-list-item($padding); } }
|
3
|
+
@import "../../typography/lists/inline-block-link";
|
@@ -1,35 +1,3 @@
|
|
1
|
-
|
1
|
+
@warn "This import is deprecated. Use 'compass/typography/lists/inline-list' instead.";
|
2
2
|
|
3
|
-
@
|
4
|
-
list-style-type: none;
|
5
|
-
&, & li {
|
6
|
-
margin: 0px;
|
7
|
-
padding: 0px;
|
8
|
-
display: inline;
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
|
-
// makes an inline list that is comma delimited.
|
13
|
-
// Please make note of the browser support issues before using this mixin.
|
14
|
-
//
|
15
|
-
// use of `content` and `:after` is not fully supported in all browsers.
|
16
|
-
// See quirksmode for the [support matrix](http://www.quirksmode.org/css/contents.html#t15)
|
17
|
-
//
|
18
|
-
// `:last-child` is not fully supported.
|
19
|
-
// see quirksmode for the [support matrix](http://www.quirksmode.org/css/contents.html#t29).
|
20
|
-
//
|
21
|
-
// IE8 ignores rules that are included on the same line as :last-child
|
22
|
-
// see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details
|
23
|
-
|
24
|
-
@mixin comma-delimited-list {
|
25
|
-
@include inline-list;
|
26
|
-
li {
|
27
|
-
&:after { content: ", "; }
|
28
|
-
&:last-child {
|
29
|
-
&:after { content: ""; }
|
30
|
-
}
|
31
|
-
&.last {
|
32
|
-
&:after { content: ""; }
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
3
|
+
@import "../../typography/lists/inline-list";
|
@@ -1,25 +1,3 @@
|
|
1
|
-
@import
|
1
|
+
@warn "This import is deprecated. Use 'compass/typography/text/ellipsis' instead.";
|
2
2
|
|
3
|
-
|
4
|
-
//
|
5
|
-
// compass install compass/ellipsis
|
6
|
-
$use-mozilla-ellipsis-binding: false !default;
|
7
|
-
|
8
|
-
// This technique, by [Justin Maxwell](http://code404.com/), was originally
|
9
|
-
// published [here](http://mattsnider.com/css/css-string-truncation-with-ellipsis/).
|
10
|
-
// Firefox implementation by [Rikkert Koppes](http://www.rikkertkoppes.com/thoughts/2008/6/).
|
11
|
-
@mixin ellipsis($no-wrap: true) {
|
12
|
-
@if $no-wrap { white-space: nowrap; }
|
13
|
-
overflow: hidden;
|
14
|
-
@include experimental(text-overflow, ellipsis,
|
15
|
-
not -moz,
|
16
|
-
not -webkit,
|
17
|
-
-o,
|
18
|
-
-ms,
|
19
|
-
not -khtml,
|
20
|
-
official
|
21
|
-
);
|
22
|
-
@if $experimental-support-for-mozilla and $use-mozilla-ellipsis-binding {
|
23
|
-
-moz-binding: stylesheet-url(unquote("xml/ellipsis.xml#ellipsis"));
|
24
|
-
}
|
25
|
-
}
|
3
|
+
@import "../../typography/text/ellipsis";
|
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
@warn "This import is deprecated. Use 'compass/typography/text/nowrap' instead.";
|
2
|
+
|
3
|
+
@import "../../typography/text/nowrap";
|
@@ -1,34 +1,3 @@
|
|
1
|
-
|
2
|
-
// If you use this on an inline element, you will need to change the display to block or inline-block.
|
3
|
-
// Also, if the size of the image differs significantly from the font size, you'll need to set the width and/or height.
|
4
|
-
//
|
5
|
-
// Parameters:
|
6
|
-
//
|
7
|
-
// * `img` -- the relative path from the project image directory to the image.
|
8
|
-
// * `x` -- the x position of the background image.
|
9
|
-
// * `y` -- the y position of the background image.
|
10
|
-
@mixin replace-text($img, $x: 50%, $y: 50%) {
|
11
|
-
@include hide-text;
|
12
|
-
background: {
|
13
|
-
image: image-url($img);
|
14
|
-
repeat: no-repeat;
|
15
|
-
position: $x $y;
|
16
|
-
};
|
17
|
-
}
|
1
|
+
@warn "This import is deprecated. Use 'compass/typography/text/replacement' instead.";
|
18
2
|
|
19
|
-
|
20
|
-
// and height of the element according the dimensions of the image.
|
21
|
-
@mixin replace-text-with-dimensions($img, $x: 50%, $y: 50%) {
|
22
|
-
@include replace-text($img, $x, $y);
|
23
|
-
width: image-width($img);
|
24
|
-
height: image-height($img);
|
25
|
-
}
|
26
|
-
|
27
|
-
// Hides text in an element so you can see the background.
|
28
|
-
@mixin hide-text {
|
29
|
-
$approximate_em_value: 12px / 1em;
|
30
|
-
$wider_than_any_screen: -9999em;
|
31
|
-
text-indent: $wider_than_any_screen * $approximate_em_value;
|
32
|
-
overflow: hidden;
|
33
|
-
text-align: left;
|
34
|
-
}
|
3
|
+
@import "../../typography/text/replacement";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// Since you've installed the xml file, you should set
|
2
2
|
// $use-mozilla-ellipsis-binding to true before importing.
|
3
3
|
$use-mozilla-ellipsis-binding: true
|
4
|
-
@import compass/
|
4
|
+
@import compass/typography/text/ellipsis
|
5
5
|
|
6
6
|
// You can delete this sass file if you want, it's just an example of how to use the ellipsis mixin.
|
7
7
|
// By default, ellipsis text is no-wrap. Pass false as the first argument if you don't want that.
|
data/lib/compass.rb
CHANGED
data/lib/compass/compiler.rb
CHANGED
@@ -3,7 +3,7 @@ module Compass
|
|
3
3
|
|
4
4
|
include Actions
|
5
5
|
|
6
|
-
attr_accessor :working_path, :from, :to, :options
|
6
|
+
attr_accessor :working_path, :from, :to, :options, :staleness_checker, :importer
|
7
7
|
|
8
8
|
def initialize(working_path, from, to, options)
|
9
9
|
self.working_path = working_path
|
@@ -12,6 +12,8 @@ module Compass
|
|
12
12
|
self.options = options
|
13
13
|
self.options[:cache_location] ||= determine_cache_location
|
14
14
|
Compass.configure_sass_plugin!
|
15
|
+
self.importer = Sass::Importers::Filesystem.new(from)
|
16
|
+
self.staleness_checker = Sass::Plugin::StalenessChecker.new(options)
|
15
17
|
end
|
16
18
|
|
17
19
|
def determine_cache_location
|
@@ -23,6 +25,10 @@ module Compass
|
|
23
25
|
@sass_files = self.options[:sass_files] || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.s[ac]ss"))
|
24
26
|
end
|
25
27
|
|
28
|
+
def relative_stylesheet_name(sass_file)
|
29
|
+
sass_file[("#{from}/".length)..-1]
|
30
|
+
end
|
31
|
+
|
26
32
|
def stylesheet_name(sass_file)
|
27
33
|
sass_file[("#{from}/".length)..-6]
|
28
34
|
end
|
@@ -42,11 +48,15 @@ module Compass
|
|
42
48
|
# Returns the sass file that needs to be compiled, if any.
|
43
49
|
def out_of_date?
|
44
50
|
sass_files.zip(css_files).each do |sass_filename, css_filename|
|
45
|
-
return sass_filename if
|
51
|
+
return sass_filename if needs_update?(css_filename, sass_filename)
|
46
52
|
end
|
47
53
|
false
|
48
54
|
end
|
49
55
|
|
56
|
+
def needs_update?(css_filename, sass_filename)
|
57
|
+
staleness_checker.stylesheet_needs_update?(css_filename, relative_stylesheet_name(sass_filename), importer)
|
58
|
+
end
|
59
|
+
|
50
60
|
# Determines if the configuration file is newer than any css file
|
51
61
|
def new_config?
|
52
62
|
config_file = Compass.detect_configuration_file
|
@@ -119,10 +129,11 @@ module Compass
|
|
119
129
|
end
|
120
130
|
duration = additional_options[:time] ? "(#{(css_content.__duration * 1000).round / 1000.0}s)" : ""
|
121
131
|
write_file(css_filename, css_content, options.merge(:force => true, :extra => duration))
|
132
|
+
Compass.configuration.run_callback(:stylesheet_saved, css_filename)
|
122
133
|
end
|
123
134
|
|
124
135
|
def should_compile?(sass_filename, css_filename)
|
125
|
-
options[:force] ||
|
136
|
+
options[:force] || needs_update?(css_filename, sass_filename)
|
126
137
|
end
|
127
138
|
|
128
139
|
# A sass engine for compiling a single file.
|
@@ -136,7 +147,10 @@ module Compass
|
|
136
147
|
# formatted to display in the browser (in development mode)
|
137
148
|
# if there's an error.
|
138
149
|
def handle_exception(sass_filename, css_filename, e)
|
139
|
-
|
150
|
+
formatted_error = "(Line #{e.sass_line}: #{e.message})"
|
151
|
+
file = basename(sass_filename)
|
152
|
+
logger.record :error, file, formatted_error
|
153
|
+
Compass.configuration.run_callback(:styesheet_error, sass_filename, formatted_error)
|
140
154
|
write_file css_filename, error_contents(e, sass_filename), options.merge(:force => true)
|
141
155
|
end
|
142
156
|
|
@@ -43,6 +43,6 @@ module Compass
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'paths', 'data'].each do |lib|
|
46
|
+
['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'paths', 'data', 'file_data'].each do |lib|
|
47
47
|
require "compass/configuration/#{lib}"
|
48
48
|
end
|
@@ -135,6 +135,16 @@ module Compass
|
|
135
135
|
relative_assets || http_images_path == :relative
|
136
136
|
end
|
137
137
|
|
138
|
+
def run_callback(event, *args)
|
139
|
+
begin
|
140
|
+
send(:"run_#{event}", *args)
|
141
|
+
rescue NoMethodError => e
|
142
|
+
unless e.message =~ /run_#{event}/
|
143
|
+
raise
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
138
148
|
private
|
139
149
|
|
140
150
|
def assert_valid_keys!(attr_hash)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Compass
|
2
|
+
module Configuration
|
3
|
+
class FileData < Data
|
4
|
+
extend Sass::Callbacks
|
5
|
+
|
6
|
+
# on_sprite_generated
|
7
|
+
# yields the filename
|
8
|
+
# usage: on_sprite_save {|filename| do_somethign(filename) }
|
9
|
+
define_callback :sprite_saved
|
10
|
+
|
11
|
+
# on_sprite_generated
|
12
|
+
# yields 'ChunkyPNG::Image'
|
13
|
+
# usage: on_sprite_generated {|sprite_data| do_something(sprite_data) }
|
14
|
+
define_callback :sprite_generated
|
15
|
+
|
16
|
+
# on_stylesheet_saved
|
17
|
+
# yields the filename
|
18
|
+
# usage: on_stylesheet_saved {|filename| do_something(filename) }
|
19
|
+
define_callback :stylesheet_saved
|
20
|
+
|
21
|
+
# on_stylesheet_error
|
22
|
+
# yields the filename & message
|
23
|
+
# usage: on_stylesheet_error {|filename, message| do_something(filename, message) }
|
24
|
+
define_callback :stylesheet_error
|
25
|
+
|
26
|
+
def self.new_from_file(config_file, defaults = nil)
|
27
|
+
data = new(config_file)
|
28
|
+
data.with_defaults(defaults) do
|
29
|
+
data._parse(config_file)
|
30
|
+
end
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.new_from_string(contents, filename, defaults = nil)
|
35
|
+
data = new(filename)
|
36
|
+
data.with_defaults(defaults) do
|
37
|
+
data.parse_string(contents, filename)
|
38
|
+
end
|
39
|
+
data
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -34,11 +34,11 @@ module Compass
|
|
34
34
|
config
|
35
35
|
elsif config.respond_to?(:read)
|
36
36
|
filename ||= config.to_s if config.is_a?(Pathname)
|
37
|
-
Compass::Configuration::
|
37
|
+
Compass::Configuration::FileData.new_from_string(config.read, filename, defaults)
|
38
38
|
elsif config.is_a?(Hash)
|
39
39
|
Compass::Configuration::Data.new(filename, config)
|
40
40
|
elsif config.is_a?(String)
|
41
|
-
Compass::Configuration::
|
41
|
+
Compass::Configuration::FileData.new_from_file(config, defaults)
|
42
42
|
elsif config.is_a?(Symbol)
|
43
43
|
Compass::AppIntegration.lookup(config).configuration
|
44
44
|
else
|
@@ -65,6 +65,12 @@ module Compass
|
|
65
65
|
Sass::Plugin.add_template_location sass_dir, css_dir
|
66
66
|
end
|
67
67
|
end
|
68
|
+
Sass::Plugin.on_updating_stylesheet do |sass_file, css_file|
|
69
|
+
Compass.configuration.run_callback(:stylesheet_saved, css_file)
|
70
|
+
end
|
71
|
+
Sass::Plugin.on_compilation_error do |e, filename, css|
|
72
|
+
Compass.configuration.run_callback(:stylesheet_error, filename, e.message)
|
73
|
+
end
|
68
74
|
end
|
69
75
|
|
70
76
|
def sass_engine_options
|
@@ -141,9 +141,9 @@ module Compass
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
def method_missing(meth)
|
144
|
+
def method_missing(meth, *args, &block)
|
145
145
|
if inherited_data
|
146
|
-
inherited_data.send(meth)
|
146
|
+
inherited_data.send(meth, *args, &block)
|
147
147
|
else
|
148
148
|
raise NoMethodError, meth.to_s
|
149
149
|
end
|
@@ -2,100 +2,75 @@ module Compass
|
|
2
2
|
module Configuration
|
3
3
|
# The serialization module manages reading and writing the configuration file(s).
|
4
4
|
module Serialization
|
5
|
-
def
|
6
|
-
|
7
|
-
base.extend ClassMethods
|
5
|
+
def parse(config_file)
|
6
|
+
raise Compass::Error, "Compass.configuration.parse(filename) has been removed. Please call Compass.add_project_configuration(filename) instead."
|
8
7
|
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
data._parse(config_file)
|
15
|
-
end
|
16
|
-
data
|
9
|
+
# parses a configuration file which is a ruby script
|
10
|
+
def _parse(config_file)
|
11
|
+
unless File.readable?(config_file)
|
12
|
+
raise Compass::Error, "Configuration file, #{config_file}, not found or not readable."
|
17
13
|
end
|
18
|
-
|
19
|
-
|
20
|
-
data = Data.new(filename)
|
21
|
-
data.with_defaults(defaults) do
|
22
|
-
data.parse_string(contents, filename)
|
23
|
-
end
|
24
|
-
data
|
14
|
+
open(config_file) do |f|
|
15
|
+
parse_string(f.read, config_file)
|
25
16
|
end
|
26
17
|
end
|
27
18
|
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
def parse_string(contents, filename)
|
20
|
+
bind = binding
|
21
|
+
eval(contents, bind, filename)
|
22
|
+
ATTRIBUTES.each do |prop|
|
23
|
+
value = eval(prop.to_s, bind) rescue nil
|
24
|
+
value = value.to_s if value.is_a?(Pathname)
|
25
|
+
self.send("#{prop}=", value) unless value.nil?
|
31
26
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
unless File.readable?(config_file)
|
36
|
-
raise Compass::Error, "Configuration file, #{config_file}, not found or not readable."
|
37
|
-
end
|
38
|
-
open(config_file) do |f|
|
39
|
-
parse_string(f.read, config_file)
|
40
|
-
end
|
27
|
+
if @added_import_paths
|
28
|
+
self.additional_import_paths ||= []
|
29
|
+
self.additional_import_paths += @added_import_paths
|
41
30
|
end
|
31
|
+
issue_deprecation_warnings
|
32
|
+
end
|
42
33
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
value = eval(prop.to_s, bind) rescue nil
|
48
|
-
value = value.to_s if value.is_a?(Pathname)
|
49
|
-
self.send("#{prop}=", value) unless value.nil?
|
50
|
-
end
|
51
|
-
if @added_import_paths
|
52
|
-
self.additional_import_paths ||= []
|
53
|
-
self.additional_import_paths += @added_import_paths
|
54
|
-
end
|
55
|
-
issue_deprecation_warnings
|
34
|
+
def serialize
|
35
|
+
contents = ""
|
36
|
+
(required_libraries || []).each do |lib|
|
37
|
+
contents << %Q{require '#{lib}'\n}
|
56
38
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
39
|
+
(loaded_frameworks || []).each do |lib|
|
40
|
+
contents << %Q{load '#{lib}'\n}
|
41
|
+
end
|
42
|
+
(framework_path || []).each do |lib|
|
43
|
+
contents << %Q{discover '#{lib}'\n}
|
44
|
+
end
|
45
|
+
contents << "# Require any additional compass plugins here.\n"
|
46
|
+
contents << "\n" if (required_libraries || []).any?
|
47
|
+
ATTRIBUTES.each do |prop|
|
48
|
+
value = send("#{prop}_without_default")
|
49
|
+
if value.is_a?(Proc)
|
50
|
+
$stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself."
|
65
51
|
end
|
66
|
-
(
|
67
|
-
contents <<
|
52
|
+
if respond_to?("comment_for_#{prop}")
|
53
|
+
contents << send("comment_for_#{prop}")
|
68
54
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
if value.is_a?(Proc)
|
74
|
-
$stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself."
|
75
|
-
end
|
76
|
-
if respond_to?("comment_for_#{prop}")
|
77
|
-
contents << send("comment_for_#{prop}")
|
78
|
-
end
|
79
|
-
if block_given? && (to_emit = yield(prop, value))
|
80
|
-
contents << to_emit
|
81
|
-
else
|
82
|
-
contents << serialize_property(prop, value) unless value.nil?
|
83
|
-
end
|
55
|
+
if block_given? && (to_emit = yield(prop, value))
|
56
|
+
contents << to_emit
|
57
|
+
else
|
58
|
+
contents << serialize_property(prop, value) unless value.nil?
|
84
59
|
end
|
85
|
-
contents
|
86
60
|
end
|
61
|
+
contents
|
62
|
+
end
|
87
63
|
|
88
|
-
|
89
|
-
|
90
|
-
|
64
|
+
def serialize_property(prop, value)
|
65
|
+
%Q(#{prop} = #{value.inspect}\n)
|
66
|
+
end
|
91
67
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end
|
68
|
+
def issue_deprecation_warnings
|
69
|
+
if http_images_path == :relative
|
70
|
+
$stderr.puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths."
|
96
71
|
end
|
97
|
-
|
98
72
|
end
|
73
|
+
|
99
74
|
end
|
100
75
|
end
|
101
76
|
end
|