chriseppstein-compass 0.6.15 → 0.7.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/CHANGELOG.markdown +170 -0
- data/LICENSE.markdown +29 -0
- data/README.markdown +10 -2
- data/REVISION +1 -1
- data/Rakefile +126 -0
- data/VERSION.yml +2 -2
- data/deps.rip +1 -0
- data/examples/blueprint_default/src/images/grid.png +0 -0
- data/examples/blueprint_plugins/src/images/grid.png +0 -0
- data/examples/blueprint_scoped/images/grid.png +0 -0
- data/examples/blueprint_scoped_form/images/grid.png +0 -0
- data/examples/blueprint_semantic/src/images/grid.png +0 -0
- data/examples/blueprint_semantic/src/liquid.sass +2 -2
- data/examples/blueprint_semantic/src/screen.sass +3 -3
- data/examples/compass/src/images/blue_arrow.gif +0 -0
- data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +42 -0
- data/frameworks/blueprint/stylesheets/blueprint/_reset.sass +3 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +10 -9
- data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +35 -23
- data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +7 -7
- data/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +56 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +2 -2
- data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +2 -1
- data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +3 -2
- data/frameworks/blueprint/templates/project/manifest.rb +2 -1
- data/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
- data/frameworks/blueprint/templates/project/screen.sass +38 -6
- data/frameworks/compass/stylesheets/compass/_utilities.sass +1 -0
- data/frameworks/compass/stylesheets/compass/utilities/_sprites.sass +1 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +106 -28
- data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +1 -1
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +12 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -3
- data/frameworks/compass/templates/project/manifest.rb +1 -1
- data/frameworks/compass/templates/project/screen.sass +6 -0
- data/lib/compass/actions.rb +7 -0
- data/lib/compass/{merb.rb → app_integration/merb.rb} +0 -0
- data/lib/compass/app_integration/rails/action_controller.rb +15 -0
- data/lib/compass/app_integration/rails/image_url.rb +14 -0
- data/lib/compass/app_integration/rails/sass_plugin.rb +5 -0
- data/lib/compass/app_integration/rails/templates/compass-install-rails.rb +80 -0
- data/lib/compass/app_integration/rails.rb +12 -0
- data/lib/compass/app_integration.rb +5 -0
- data/lib/compass/commands/project_base.rb +12 -2
- data/lib/compass/commands/update_project.rb +13 -3
- data/lib/compass/commands/watch_project.rb +27 -28
- data/lib/compass/commands/write_configuration.rb +5 -1
- data/lib/compass/compiler.rb +14 -2
- data/lib/compass/configuration.rb +78 -2
- data/lib/compass/exec.rb +78 -37
- data/lib/compass/installers/base.rb +4 -2
- data/lib/compass/installers/rails.rb +3 -2
- data/lib/compass/installers/stand_alone.rb +3 -2
- data/lib/compass/sass_extensions/functions/display.rb +22 -0
- data/lib/compass/sass_extensions/functions/enumerate.rb +6 -0
- data/lib/compass/sass_extensions/functions/image_url.rb +88 -0
- data/lib/compass/sass_extensions/functions/inline_image.rb +35 -0
- data/lib/compass/sass_extensions/functions/selectors.rb +39 -0
- data/lib/compass/sass_extensions/functions.rb +19 -0
- data/lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb +23 -0
- data/lib/compass/sass_extensions/monkey_patches.rb +3 -0
- data/lib/compass/sass_extensions.rb +5 -0
- data/lib/compass/version.rb +2 -3
- data/lib/compass.rb +3 -18
- data/test/command_line_helper.rb +102 -0
- data/test/command_line_test.rb +2 -106
- data/test/compass_test.rb +18 -6
- data/test/configuration_test.rb +73 -0
- data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +42 -46
- data/test/fixtures/stylesheets/compass/sass/reset.sass +9 -0
- data/test/fixtures/stylesheets/image_urls/config.rb +17 -0
- data/test/fixtures/stylesheets/image_urls/css/screen.css +3 -0
- data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/image_urls/sass/screen.sass +6 -0
- data/test/rails_integration_test.rb +83 -0
- data/test/sass_extensions_test.rb +0 -1
- data/test/test_case_helper.rb +13 -0
- data/test/test_helper.rb +3 -27
- data/test/test_rails_helper.rb +20 -0
- metadata +51 -4
- data/lib/sass_extensions.rb +0 -67
@@ -0,0 +1,39 @@
|
|
1
|
+
module Compass::SassExtensions::Functions::Selectors
|
2
|
+
COMMA_SEPARATOR = /\s*,\s*/
|
3
|
+
|
4
|
+
# Permute multiple selectors each of which may be comma delimited, the end result is
|
5
|
+
# a new selector that is the equivalent of nesting each under the previous selector.
|
6
|
+
# To illustrate, the following mixins are equivalent:
|
7
|
+
# =mixin-a(!selector1, !selector2, !selector3)
|
8
|
+
# #{!selector1}
|
9
|
+
# #{selector2}
|
10
|
+
# #{selector3}
|
11
|
+
# width: 2px
|
12
|
+
# =mixin-b(!selector1, !selector2)
|
13
|
+
# #{nest(!selector, !selector2, !selector3)}
|
14
|
+
# width: 2px
|
15
|
+
def nest(*arguments)
|
16
|
+
nested = arguments.map{|a| a.value}.inject do |memo,arg|
|
17
|
+
ancestors = memo.split(COMMA_SEPARATOR)
|
18
|
+
descendants = arg.split(COMMA_SEPARATOR)
|
19
|
+
ancestors.map{|a| descendants.map{|d| "#{a} #{d}"}.join(", ")}.join(", ")
|
20
|
+
end
|
21
|
+
Sass::Script::String.new(nested)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Permute two selectors, the first may be comma delimited.
|
25
|
+
# The end result is a new selector that is the equivalent of nesting the second
|
26
|
+
# selector under the first one in a sass file and preceding it with an &.
|
27
|
+
# To illustrate, the following mixins are equivalent:
|
28
|
+
# =mixin-a(!selector, !to_append)
|
29
|
+
# #{!selector}
|
30
|
+
# &#{!to_append}
|
31
|
+
# width: 2px
|
32
|
+
# =mixin-b(!selector, !to_append)
|
33
|
+
# #{append_selector(!selector, !to_append)}
|
34
|
+
# width: 2px
|
35
|
+
def append_selector(selector, to_append)
|
36
|
+
Sass::Script::String.new(selector.value.split(COMMA_SEPARATOR).map{|s| "#{s}#{to_append}"}.join(", "))
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Compass::SassExtensions::Functions
|
2
|
+
end
|
3
|
+
|
4
|
+
['selectors', 'enumerate', 'image_url', 'display', 'inline_image'].each do |func|
|
5
|
+
require File.join(File.dirname(__FILE__), 'functions', func)
|
6
|
+
end
|
7
|
+
|
8
|
+
module Sass::Script::Functions
|
9
|
+
include Compass::SassExtensions::Functions::Selectors
|
10
|
+
include Compass::SassExtensions::Functions::Enumerate
|
11
|
+
include Compass::SassExtensions::Functions::ImageUrl
|
12
|
+
include Compass::SassExtensions::Functions::Display
|
13
|
+
include Compass::SassExtensions::Functions::InlineImage
|
14
|
+
end
|
15
|
+
|
16
|
+
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
17
|
+
class Sass::Script::Functions::EvaluationContext
|
18
|
+
include Sass::Script::Functions
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'sass/plugin'
|
2
|
+
|
3
|
+
# XXX: We can remove this monkeypatch once Sass 2.2 is released.
|
4
|
+
module Sass::Plugin
|
5
|
+
class << self
|
6
|
+
unless method_defined?(:exact_stylesheet_needs_update?)
|
7
|
+
def stylesheet_needs_update?(name, template_path, css_path)
|
8
|
+
css_file = css_filename(name, css_path)
|
9
|
+
template_file = template_filename(name, template_path)
|
10
|
+
exact_stylesheet_needs_update?(css_file, template_file)
|
11
|
+
end
|
12
|
+
def exact_stylesheet_needs_update?(css_file, template_file)
|
13
|
+
if !File.exists?(css_file)
|
14
|
+
return true
|
15
|
+
else
|
16
|
+
css_mtime = File.mtime(css_file)
|
17
|
+
File.mtime(template_file) > css_mtime ||
|
18
|
+
dependencies(template_file).any?(&dependency_updated?(css_mtime))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/compass/version.rb
CHANGED
@@ -3,8 +3,7 @@ module Compass
|
|
3
3
|
# Returns a hash representing the version.
|
4
4
|
# The :major, :minor, and :teeny keys have their respective numbers.
|
5
5
|
# The :string key contains a human-readable string representation of the version.
|
6
|
-
#
|
7
|
-
# the :rev key will have the revision hash.
|
6
|
+
# The :rev key will have the current revision hash.
|
8
7
|
#
|
9
8
|
# This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum
|
10
9
|
attr_writer :version
|
@@ -41,7 +40,7 @@ module Compass
|
|
41
40
|
def revision_from_file
|
42
41
|
if File.exists?(scope('REVISION'))
|
43
42
|
rev = File.read(scope('REVISION')).strip
|
44
|
-
rev
|
43
|
+
rev if rev =~ /[a-f0-9]+/
|
45
44
|
end
|
46
45
|
end
|
47
46
|
|
data/lib/compass.rb
CHANGED
@@ -1,21 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
def assert_sass_version(obj)
|
4
|
-
unless obj.respond_to?(:version) && obj.version[:major] == 2 && obj.version[:minor] >= 1
|
5
|
-
raise LoadError.new("Compass requires Haml version 2.1 or greater.")
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
begin
|
10
|
-
assert_sass_version(Sass)
|
11
|
-
rescue LoadError
|
12
|
-
require 'haml'
|
13
|
-
assert_sass_version(Haml)
|
1
|
+
module Compass
|
14
2
|
end
|
15
3
|
|
16
|
-
|
17
|
-
|
18
|
-
['core_ext', 'version'].each do |file|
|
4
|
+
['dependencies', 'sass_extensions', 'core_ext', 'version', 'errors'].each do |file|
|
19
5
|
require File.join(File.dirname(__FILE__), 'compass', file)
|
20
6
|
end
|
21
7
|
|
@@ -32,7 +18,6 @@ end
|
|
32
18
|
|
33
19
|
require File.join(File.dirname(__FILE__), 'compass', 'configuration')
|
34
20
|
require File.join(File.dirname(__FILE__), 'compass', 'frameworks')
|
21
|
+
require File.join(File.dirname(__FILE__), 'compass', 'app_integration')
|
35
22
|
|
36
|
-
# make sure we're running inside Merb
|
37
|
-
require File.join(File.dirname(__FILE__), 'compass', 'merb') if defined?(Merb::Plugins)
|
38
23
|
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module Compass::CommandLineHelper
|
2
|
+
def compass(*arguments)
|
3
|
+
options = arguments.last.is_a?(Hash) ? arguments.pop : {}
|
4
|
+
options[:wait] = 0.25
|
5
|
+
if block_given?
|
6
|
+
responder = Responder.new
|
7
|
+
yield responder
|
8
|
+
IO.popen("-", "w+") do |io|
|
9
|
+
if io
|
10
|
+
#parent process
|
11
|
+
output = ""
|
12
|
+
eof_at = nil
|
13
|
+
while !eof_at || (Time.now - eof_at < options[:wait])
|
14
|
+
if io.eof?
|
15
|
+
eof_at ||= Time.now
|
16
|
+
sleep 0.1
|
17
|
+
else
|
18
|
+
eof_at = nil
|
19
|
+
timeout(1) do
|
20
|
+
output << io.readpartial(1024)
|
21
|
+
end
|
22
|
+
prompt = output.split("\n").last
|
23
|
+
if response = responder.response_for(prompt)
|
24
|
+
io.puts response
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
responder.assert_required_responses!
|
29
|
+
@last_result = output
|
30
|
+
else
|
31
|
+
#child process
|
32
|
+
execute *arguments
|
33
|
+
end
|
34
|
+
end
|
35
|
+
else
|
36
|
+
@last_result = capture_output do
|
37
|
+
execute *arguments
|
38
|
+
end
|
39
|
+
end
|
40
|
+
rescue Timeout::Error
|
41
|
+
fail "Read from child process timed out"
|
42
|
+
end
|
43
|
+
|
44
|
+
class Responder
|
45
|
+
Response = Struct.new(:prompt, :text, :required, :responded)
|
46
|
+
def initialize
|
47
|
+
@responses = []
|
48
|
+
end
|
49
|
+
def respond_to(prompt, options = {})
|
50
|
+
@responses << Response.new(prompt, options[:with], options[:required])
|
51
|
+
end
|
52
|
+
def response_for(prompt)
|
53
|
+
response = @responses.detect{|r| r.prompt == prompt}
|
54
|
+
if response
|
55
|
+
response.responded = true
|
56
|
+
response.text
|
57
|
+
end
|
58
|
+
end
|
59
|
+
def assert_required_responses!
|
60
|
+
@responses.each do |response|
|
61
|
+
if response.required && !response.responded
|
62
|
+
raise "Prompt not encountered: \"#{response.prompt}\""
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def assert_action_performed(action, path)
|
69
|
+
actions_found = []
|
70
|
+
@last_result.split("\n").each do |line|
|
71
|
+
line = line.split
|
72
|
+
return if line.first == action.to_s && line.last == path
|
73
|
+
actions_found << line.first if line.last == path
|
74
|
+
end
|
75
|
+
message = "Action #{action.inspect} was not performed on: #{path}."
|
76
|
+
message += "The following actions were performed: #{actions_found.join(", ")}" if actions_found.any?
|
77
|
+
puts @last_result
|
78
|
+
fail message
|
79
|
+
end
|
80
|
+
|
81
|
+
def within_tmp_directory(dir = "tmp")
|
82
|
+
d = absolutize(dir)
|
83
|
+
FileUtils.mkdir_p(d)
|
84
|
+
Dir.chdir(d) do
|
85
|
+
yield
|
86
|
+
end
|
87
|
+
ensure
|
88
|
+
FileUtils.rm_rf(d)
|
89
|
+
end
|
90
|
+
|
91
|
+
def capture_output
|
92
|
+
real_stdout, $stdout = $stdout, StringIO.new
|
93
|
+
yield
|
94
|
+
$stdout.string
|
95
|
+
ensure
|
96
|
+
$stdout = real_stdout
|
97
|
+
end
|
98
|
+
|
99
|
+
def execute(*arguments)
|
100
|
+
Compass::Exec::Compass.new(arguments).run!
|
101
|
+
end
|
102
|
+
end
|
data/test/command_line_test.rb
CHANGED
@@ -6,6 +6,7 @@ require 'timeout'
|
|
6
6
|
|
7
7
|
class CommandLineTest < Test::Unit::TestCase
|
8
8
|
include Compass::TestCaseHelper
|
9
|
+
include Compass::CommandLineHelper
|
9
10
|
|
10
11
|
def teardown
|
11
12
|
Compass.configuration.reset!
|
@@ -18,11 +19,7 @@ class CommandLineTest < Test::Unit::TestCase
|
|
18
19
|
|
19
20
|
def test_list_frameworks
|
20
21
|
compass "--list-frameworks"
|
21
|
-
assert_equal(
|
22
|
-
blueprint
|
23
|
-
compass
|
24
|
-
yui
|
25
|
-
FRAMEWORKS
|
22
|
+
assert_equal("blueprint\ncompass\nyui\n", @last_result)
|
26
23
|
end
|
27
24
|
|
28
25
|
def test_basic_install
|
@@ -66,105 +63,4 @@ FRAMEWORKS
|
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
69
|
-
def test_rails_install
|
70
|
-
within_tmp_directory do
|
71
|
-
generate_rails_app("compass_rails")
|
72
|
-
Dir.chdir "compass_rails" do
|
73
|
-
compass("--rails", ".") do |responder|
|
74
|
-
responder.respond_to "Is this OK? (Y/n) ", :with => "Y"
|
75
|
-
responder.respond_to "Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n) ", :with => "Y"
|
76
|
-
end
|
77
|
-
# puts @last_result
|
78
|
-
assert_action_performed :create, "./app/stylesheets/screen.sass"
|
79
|
-
assert_action_performed :create, "./config/initializers/compass.rb"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
rescue LoadError
|
83
|
-
puts "Skipping rails test. Couldn't Load rails"
|
84
|
-
end
|
85
|
-
|
86
|
-
protected
|
87
|
-
def compass(*arguments)
|
88
|
-
if block_given?
|
89
|
-
responder = Responder.new
|
90
|
-
yield responder
|
91
|
-
IO.popen("-", "w+") do |io|
|
92
|
-
if io
|
93
|
-
#parent process
|
94
|
-
output = ""
|
95
|
-
while !io.eof?
|
96
|
-
timeout(1) do
|
97
|
-
output << io.readpartial(512)
|
98
|
-
end
|
99
|
-
prompt = output.split("\n").last
|
100
|
-
if response = responder.response_for(prompt)
|
101
|
-
io.puts response
|
102
|
-
end
|
103
|
-
end
|
104
|
-
@last_result = output
|
105
|
-
else
|
106
|
-
#child process
|
107
|
-
execute *arguments
|
108
|
-
end
|
109
|
-
end
|
110
|
-
else
|
111
|
-
@last_result = capture_output do
|
112
|
-
execute *arguments
|
113
|
-
end
|
114
|
-
end
|
115
|
-
rescue Timeout::Error
|
116
|
-
fail "Read from child process timed out"
|
117
|
-
end
|
118
|
-
|
119
|
-
class Responder
|
120
|
-
def initialize
|
121
|
-
@responses = []
|
122
|
-
end
|
123
|
-
def respond_to(prompt, options = {})
|
124
|
-
@responses << [prompt, options[:with]]
|
125
|
-
end
|
126
|
-
def response_for(prompt)
|
127
|
-
pair = @responses.detect{|r| r.first == prompt}
|
128
|
-
pair.last if pair
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def assert_action_performed(action, path)
|
133
|
-
actions_found = []
|
134
|
-
@last_result.split("\n").each do |line|
|
135
|
-
line = line.split
|
136
|
-
return if line.first == action.to_s && line.last == path
|
137
|
-
actions_found << line.first if line.last == path
|
138
|
-
end
|
139
|
-
message = "Action #{action.inspect} was not performed on: #{path}."
|
140
|
-
message += "The following actions were performed: #{actions_found.join(", ")}" if actions_found.any?
|
141
|
-
puts @last_result
|
142
|
-
fail message
|
143
|
-
end
|
144
|
-
|
145
|
-
def within_tmp_directory(dir = "tmp")
|
146
|
-
d = absolutize(dir)
|
147
|
-
FileUtils.mkdir_p(d)
|
148
|
-
Dir.chdir(d) do
|
149
|
-
yield
|
150
|
-
end
|
151
|
-
ensure
|
152
|
-
FileUtils.rm_r(d)
|
153
|
-
end
|
154
|
-
|
155
|
-
def capture_output
|
156
|
-
real_stdout, $stdout = $stdout, StringIO.new
|
157
|
-
yield
|
158
|
-
$stdout.string
|
159
|
-
ensure
|
160
|
-
$stdout = real_stdout
|
161
|
-
end
|
162
|
-
|
163
|
-
def execute(*arguments)
|
164
|
-
Compass::Exec::Compass.new(arguments).run!
|
165
|
-
end
|
166
|
-
|
167
|
-
def generate_rails_app(name)
|
168
|
-
`rails #{name}`
|
169
|
-
end
|
170
66
|
end
|
data/test/compass_test.rb
CHANGED
@@ -9,7 +9,7 @@ class CompassTest < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
12
|
-
teardown_fixtures :blueprint, :yui, :empty, :compass
|
12
|
+
teardown_fixtures :blueprint, :yui, :empty, :compass, :image_urls
|
13
13
|
end
|
14
14
|
|
15
15
|
def teardown_fixtures(*project_names)
|
@@ -18,9 +18,10 @@ class CompassTest < Test::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def test_empty_project
|
22
|
+
# With no sass files, we should have no css files.
|
22
23
|
within_project(:empty) do |proj|
|
23
|
-
return unless File.exists?(proj.css_path)
|
24
|
+
return unless proj.css_path && File.exists?(proj.css_path)
|
24
25
|
Dir.new(proj.css_path).each do |f|
|
25
26
|
fail "This file should not have been generated: #{f}" unless f == "." || f == ".."
|
26
27
|
end
|
@@ -54,6 +55,15 @@ class CompassTest < Test::Unit::TestCase
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
58
|
+
def test_image_urls
|
59
|
+
within_project('image_urls') do |proj|
|
60
|
+
each_css_file(proj.css_path) do |css_file|
|
61
|
+
assert_no_errors css_file, 'image_urls'
|
62
|
+
end
|
63
|
+
assert_renders_correctly :screen
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
57
67
|
private
|
58
68
|
def assert_no_errors(css_file, project_name)
|
59
69
|
file = css_file[(tempfile_path(project_name).size+1)..-1]
|
@@ -80,11 +90,13 @@ private
|
|
80
90
|
|
81
91
|
def within_project(project_name)
|
82
92
|
@current_project = project_name
|
83
|
-
Compass.configuration.parse(configuration_file(project_name))
|
93
|
+
Compass.configuration.parse(configuration_file(project_name)) if File.exists?(configuration_file(project_name))
|
84
94
|
Compass.configuration.project_path = project_path(project_name)
|
85
95
|
args = Compass.configuration.to_compiler_arguments(:logger => Compass::NullLogger.new)
|
86
|
-
|
87
|
-
|
96
|
+
if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path)
|
97
|
+
compiler = Compass::Compiler.new *args
|
98
|
+
compiler.run
|
99
|
+
end
|
88
100
|
yield Compass.configuration
|
89
101
|
rescue
|
90
102
|
save_output(project_name)
|
data/test/configuration_test.rb
CHANGED
@@ -35,4 +35,77 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
35
35
|
assert_equal expected_lines, actual_lines
|
36
36
|
end
|
37
37
|
|
38
|
+
def test_serialization_fails_with_asset_host_set
|
39
|
+
contents = <<-CONFIG
|
40
|
+
asset_host do |path|
|
41
|
+
"http://example.com"
|
42
|
+
end
|
43
|
+
CONFIG
|
44
|
+
|
45
|
+
Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_host_set")
|
46
|
+
|
47
|
+
assert_raise Compass::Error do
|
48
|
+
Compass.configuration.serialize
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_serialization_fails_with_asset_cache_buster_set
|
53
|
+
contents = <<-CONFIG
|
54
|
+
asset_cache_buster do |path|
|
55
|
+
"http://example.com"
|
56
|
+
end
|
57
|
+
CONFIG
|
58
|
+
|
59
|
+
Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_cache_buster_set")
|
60
|
+
|
61
|
+
assert_raise Compass::Error do
|
62
|
+
Compass.configuration.serialize
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_additional_import_paths
|
67
|
+
contents = <<-CONFIG
|
68
|
+
project_path = "/home/chris/my_compass_project"
|
69
|
+
css_dir = "css"
|
70
|
+
additional_import_paths = ["../foo"]
|
71
|
+
add_import_path "/path/to/my/framework"
|
72
|
+
CONFIG
|
73
|
+
|
74
|
+
Compass.configuration.parse_string(contents, "test_additional_import_paths")
|
75
|
+
|
76
|
+
assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/home/chris/my_compass_project/../foo")
|
77
|
+
assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/path/to/my/framework"), Compass.configuration.to_sass_engine_options[:load_paths].inspect
|
78
|
+
assert_equal "/home/chris/my_compass_project/css/framework", Compass.configuration.to_sass_plugin_options[:template_location]["/path/to/my/framework"]
|
79
|
+
assert_equal "/home/chris/my_compass_project/css/foo", Compass.configuration.to_sass_plugin_options[:template_location]["/home/chris/my_compass_project/../foo"]
|
80
|
+
|
81
|
+
expected_serialization = <<EXPECTED
|
82
|
+
# Require any additional compass plugins here.
|
83
|
+
project_path = "/home/chris/my_compass_project"
|
84
|
+
css_dir = "css"
|
85
|
+
# To enable relative image paths using the images_url() function:
|
86
|
+
# http_images_path = :relative
|
87
|
+
additional_import_paths = ["../foo", "/path/to/my/framework"]
|
88
|
+
EXPECTED
|
89
|
+
assert_equal expected_serialization, Compass.configuration.serialize
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_sass_options
|
93
|
+
contents = <<-CONFIG
|
94
|
+
sass_options = {:foo => 'bar'}
|
95
|
+
CONFIG
|
96
|
+
|
97
|
+
Compass.configuration.parse_string(contents, "test_sass_options")
|
98
|
+
|
99
|
+
assert_equal 'bar', Compass.configuration.to_sass_engine_options[:foo]
|
100
|
+
assert_equal 'bar', Compass.configuration.to_sass_plugin_options[:foo]
|
101
|
+
|
102
|
+
expected_serialization = <<EXPECTED
|
103
|
+
# Require any additional compass plugins here.
|
104
|
+
# To enable relative image paths using the images_url() function:
|
105
|
+
# http_images_path = :relative
|
106
|
+
sass_options = {:foo=>"bar"}
|
107
|
+
EXPECTED
|
108
|
+
assert_equal expected_serialization, Compass.configuration.serialize
|
109
|
+
end
|
110
|
+
|
38
111
|
end
|
Binary file
|
@@ -1,64 +1,60 @@
|
|
1
|
-
html, body
|
1
|
+
html, body, div, span, applet, object, iframe,
|
2
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
3
|
+
a, abbr, acronym, address, big, cite, code,
|
4
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
5
|
+
small, strike, strong, sub, sup, tt, var,
|
6
|
+
dl, dt, dd, ol, ul, li,
|
7
|
+
fieldset, form, label, legend,
|
8
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
2
9
|
margin: 0;
|
3
10
|
padding: 0;
|
4
11
|
border: 0;
|
12
|
+
outline: 0;
|
5
13
|
font-weight: inherit;
|
6
14
|
font-style: inherit;
|
7
15
|
font-size: 100%;
|
8
16
|
font-family: inherit;
|
9
17
|
vertical-align: baseline; }
|
10
18
|
|
11
|
-
|
12
|
-
|
13
|
-
dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr {
|
14
|
-
margin: 0;
|
15
|
-
padding: 0;
|
16
|
-
border: 0;
|
17
|
-
font-weight: inherit;
|
18
|
-
font-style: inherit;
|
19
|
-
font-size: 100%;
|
20
|
-
font-family: inherit;
|
21
|
-
vertical-align: baseline; }
|
19
|
+
*:focus {
|
20
|
+
outline: 0; }
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
font-weight: inherit;
|
28
|
-
font-style: inherit;
|
29
|
-
font-size: 100%;
|
30
|
-
font-family: inherit;
|
31
|
-
vertical-align: baseline;
|
32
|
-
quotes: "" ""; }
|
33
|
-
blockquote:before, q:before,
|
34
|
-
blockquote:after, q:after {
|
35
|
-
content: ""; }
|
22
|
+
body {
|
23
|
+
line-height: 1em;
|
24
|
+
color: black;
|
25
|
+
background: #fff; }
|
36
26
|
|
37
|
-
|
38
|
-
|
39
|
-
padding: 0;
|
40
|
-
border: 0;
|
41
|
-
font-weight: inherit;
|
42
|
-
font-style: inherit;
|
43
|
-
font-size: 100%;
|
44
|
-
font-family: inherit;
|
45
|
-
vertical-align: baseline;
|
46
|
-
text-align: left;
|
47
|
-
font-weight: normal;
|
48
|
-
vertical-align: middle; }
|
27
|
+
ol, ul {
|
28
|
+
list-style: none; }
|
49
29
|
|
30
|
+
/* tables still need 'cellspacing="0"' in the markup */
|
50
31
|
table {
|
51
|
-
margin: 0;
|
52
|
-
padding: 0;
|
53
|
-
border: 0;
|
54
|
-
font-weight: inherit;
|
55
|
-
font-style: inherit;
|
56
|
-
font-size: 100%;
|
57
|
-
font-family: inherit;
|
58
|
-
vertical-align: baseline;
|
59
32
|
border-collapse: separate;
|
60
33
|
border-spacing: 0;
|
61
34
|
vertical-align: middle; }
|
62
35
|
|
63
|
-
|
36
|
+
caption, th, td {
|
37
|
+
text-align: left;
|
38
|
+
font-weight: normal;
|
39
|
+
vertical-align: middle; }
|
40
|
+
|
41
|
+
q, blockquote {
|
42
|
+
quotes: "" ""; }
|
43
|
+
q:before, q:after, blockquote:before, blockquote:after {
|
44
|
+
content: ""; }
|
45
|
+
|
46
|
+
img a {
|
64
47
|
border: none; }
|
48
|
+
|
49
|
+
.unregistered-only, .registered-only {
|
50
|
+
display: none; }
|
51
|
+
|
52
|
+
body.registered a.registered-only, body.registered abbr.registered-only, body.registered acronym.registered-only, body.registered b.registered-only, body.registered basefont.registered-only, body.registered bdo.registered-only, body.registered big.registered-only, body.registered br.registered-only, body.registered cite.registered-only, body.registered code.registered-only, body.registered dfn.registered-only, body.registered em.registered-only, body.registered font.registered-only, body.registered i.registered-only, body.registered img.registered-only, body.registered input.registered-only, body.registered kbd.registered-only, body.registered label.registered-only, body.registered q.registered-only, body.registered s.registered-only, body.registered samp.registered-only, body.registered select.registered-only, body.registered small.registered-only, body.registered span.registered-only, body.registered strike.registered-only, body.registered strong.registered-only, body.registered sub.registered-only, body.registered sup.registered-only, body.registered textarea.registered-only, body.registered tt.registered-only, body.registered u.registered-only, body.registered var.registered-only {
|
53
|
+
display: inline; }
|
54
|
+
body.registered address.registered-only, body.registered blockquote.registered-only, body.registered center.registered-only, body.registered dir.registered-only, body.registered div.registered-only, body.registered dd.registered-only, body.registered dl.registered-only, body.registered dt.registered-only, body.registered fieldset.registered-only, body.registered form.registered-only, body.registered frameset.registered-only, body.registered h1.registered-only, body.registered h2.registered-only, body.registered h3.registered-only, body.registered h4.registered-only, body.registered h5.registered-only, body.registered h6.registered-only, body.registered hr.registered-only, body.registered isindex.registered-only, body.registered menu.registered-only, body.registered noframes.registered-only, body.registered noscript.registered-only, body.registered ol.registered-only, body.registered p.registered-only, body.registered pre.registered-only, body.registered ul.registered-only {
|
55
|
+
display: block; }
|
56
|
+
|
57
|
+
body.unregistered a.unregistered-only, body.unregistered abbr.unregistered-only, body.unregistered acronym.unregistered-only, body.unregistered b.unregistered-only, body.unregistered basefont.unregistered-only, body.unregistered bdo.unregistered-only, body.unregistered big.unregistered-only, body.unregistered br.unregistered-only, body.unregistered cite.unregistered-only, body.unregistered code.unregistered-only, body.unregistered dfn.unregistered-only, body.unregistered em.unregistered-only, body.unregistered font.unregistered-only, body.unregistered i.unregistered-only, body.unregistered img.unregistered-only, body.unregistered input.unregistered-only, body.unregistered kbd.unregistered-only, body.unregistered label.unregistered-only, body.unregistered q.unregistered-only, body.unregistered s.unregistered-only, body.unregistered samp.unregistered-only, body.unregistered select.unregistered-only, body.unregistered small.unregistered-only, body.unregistered span.unregistered-only, body.unregistered strike.unregistered-only, body.unregistered strong.unregistered-only, body.unregistered sub.unregistered-only, body.unregistered sup.unregistered-only, body.unregistered textarea.unregistered-only, body.unregistered tt.unregistered-only, body.unregistered u.unregistered-only, body.unregistered var.unregistered-only {
|
58
|
+
display: inline; }
|
59
|
+
body.unregistered address.unregistered-only, body.unregistered blockquote.unregistered-only, body.unregistered center.unregistered-only, body.unregistered dir.unregistered-only, body.unregistered div.unregistered-only, body.unregistered dd.unregistered-only, body.unregistered dl.unregistered-only, body.unregistered dt.unregistered-only, body.unregistered fieldset.unregistered-only, body.unregistered form.unregistered-only, body.unregistered frameset.unregistered-only, body.unregistered h1.unregistered-only, body.unregistered h2.unregistered-only, body.unregistered h3.unregistered-only, body.unregistered h4.unregistered-only, body.unregistered h5.unregistered-only, body.unregistered h6.unregistered-only, body.unregistered hr.unregistered-only, body.unregistered isindex.unregistered-only, body.unregistered menu.unregistered-only, body.unregistered noframes.unregistered-only, body.unregistered noscript.unregistered-only, body.unregistered ol.unregistered-only, body.unregistered p.unregistered-only, body.unregistered pre.unregistered-only, body.unregistered ul.unregistered-only {
|
60
|
+
display: block; }
|
@@ -1 +1,10 @@
|
|
1
1
|
@import compass/reset.sass
|
2
|
+
|
3
|
+
// Turn off the display for both of these classes
|
4
|
+
.unregistered-only, .registered-only
|
5
|
+
:display none
|
6
|
+
// Now turn only one of them back on depending on some other context.
|
7
|
+
body.registered
|
8
|
+
+reset-display(".registered-only")
|
9
|
+
body.unregistered
|
10
|
+
+reset-display(".unregistered-only")
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Require any additional compass plugins here.
|
2
|
+
project_type = :stand_alone
|
3
|
+
css_dir = "tmp"
|
4
|
+
sass_dir = "sass"
|
5
|
+
images_dir = "images"
|
6
|
+
output_style = :compact
|
7
|
+
# To enable relative image paths using the images_url() function:
|
8
|
+
# http_images_path = :relative
|
9
|
+
http_images_path = "/images"
|
10
|
+
|
11
|
+
asset_cache_buster do |path, file|
|
12
|
+
"busted=true"
|
13
|
+
end
|
14
|
+
|
15
|
+
asset_host do |path|
|
16
|
+
"http://assets%d.example.com" % (path.hash % 4)
|
17
|
+
end
|
@@ -0,0 +1,3 @@
|
|
1
|
+
.showgrid { background-image: url(http://assets2.example.com/images/grid.png?busted=true); }
|
2
|
+
|
3
|
+
.inlinegrid { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAUEAYAAACv1qP4AAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAZ0lEQVRYw+3QwQ2AIBAFUTEUwI3+uzN7gDscsIgxEuO8An52J11X73OudfxMraXkzHfO3Y98nQEhA0IGhAwIGRAyIGRAyICQASEDQgaEDAgZEDIgZEDIgJABoZzSGK3tPuN9ERFP7Nw4fg+c5g8V1wAAAABJRU5ErkJggg=='); }
|
Binary file
|