Merge branch 'stable'

Conflicts:
	doc-src/content/CHANGELOG.markdown
	lib/compass/commands/watch_project.rb
This commit is contained in:
Chris Eppstein 2012-03-05 11:30:52 -08:00
commit b8c0928f86
9 changed files with 88 additions and 35 deletions

View File

@ -79,7 +79,13 @@ gem to integrate with compass. Please read the [README](https://github.com/Compa
`generated-image-url()` helper function. These should rarely be needed and `generated-image-url()` helper function. These should rarely be needed and
will default to your corresponding image directories and paths. will default to your corresponding image directories and paths.
0.11.7 (UNRELEASED) 0.11.8 (02/26/2012)
-------------------
* Fix a bug in gradients that used the transparent keyword
* Add filesize to the `compass stats` output.
0.11.7 (01/05/2012)
------------------- -------------------
* Update to font-face mixin to make it work on IE8. * Update to font-face mixin to make it work on IE8.

View File

@ -412,7 +412,7 @@ to avoid crashing the watcher in the case where the file has been removed.
on_stylesheet_saved do |filename| on_stylesheet_saved do |filename|
Growl.notify { Growl.notify {
self.message "#{File.basename(filename)} updated!" self.message = "#{File.basename(filename)} updated!"
self.icon = '/path/to/success.jpg' self.icon = '/path/to/success.jpg'
} }
end end

View File

@ -89,12 +89,12 @@ If the tests fail, fix the tests or the stylesheets accordingly. If the tests, d
fail, that means this aspect was not well enough tested. Please [add or augment fail, that means this aspect was not well enough tested. Please [add or augment
a test](#writing-tests). a test](#writing-tests).
You're done. Please [submit your changes](#patches) You're done. Please [submit your changes](#patches).
<h2 id="stylesheet-changes">Making Stylesheet Changes</h2> <h2 id="stylesheet-changes">Making Stylesheet Changes</h2>
It is a good idea to discuss new features ideas with the compass users and developers It is a good idea to discuss new features ideas with the compass users and developers
before building something. Please don't by shy; send an email to the [compass mailing before building something. Please don't be shy; send an email to the [compass mailing
list](http://groups.google.com/group/compass-users). list](http://groups.google.com/group/compass-users).
Many feature ideas are good but not obviously a good fit for the compass core library. Many feature ideas are good but not obviously a good fit for the compass core library.
@ -112,7 +112,7 @@ making extensions.][extensions]
**Step 6**: Documentation - Add or update the reference documentation. Add **Step 6**: Documentation - Add or update the reference documentation. Add
an example of using the feature. See the [doc readme for details][documentation]. an example of using the feature. See the [doc readme for details][documentation].
You're done. Please [submit your changes](#patches) You're done. Please [submit your changes](#patches).
<h2 id="ruby-changes">Making Ruby Changes</h2> <h2 id="ruby-changes">Making Ruby Changes</h2>

View File

@ -1,3 +1,3 @@
@warn "This import is deprecated. Use 'compass/typography/lists/inline-block-list' instead."; @warn "This import is deprecated. Use 'compass/typography/lists/inline-block-list' instead.";
@import "../../typography/lists/inline-block-link"; @import "../../typography/lists/inline-block-list";

View File

@ -34,13 +34,16 @@ module Compass
compiler = new_compiler_instance compiler = new_compiler_instance
sass_files = sorted_sass_files(compiler) sass_files = sorted_sass_files(compiler)
total_label = "Total (#{sass_files.size} files):" total_label = "Total (#{sass_files.size} files):"
rows = [[ :-, :-, :-, :-, :-, :-, :- ], rows = [[ :-, :-, :-, :-, :-, :-, :-, :-, :- ],
[ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used', 'CSS Selectors', 'CSS Properties' ], [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used', 'Filesize', 'CSS Selectors', 'CSS Properties', 'CSS Filesize' ],
[ :-, :-, :-, :-, :-, :-, :- ]] [ :-, :-, :-, :-, :-, :-, :-, :-, :- ]]
maximums = [ total_label.length, 5, 10, 14, 11, 13, 14 ] maximums = [ total_label.length, 5, 10, 14, 11, 13, 13, 14, 14 ]
alignments = [ :left, :right, :right, :right, :right, :right, :right ] alignments = [ :left, :right, :right, :right, :right, :right, :right, :right, :right ]
delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ]
totals = [ total_label, 0, 0, 0, 0, 0, 0 ] formatters = [ nil, nil, nil, nil, nil, :kb, nil, nil, :kb ]
totals = [ total_label, 0, 0, 0, 0, 0, 0, 0, 0 ]
columns = rows.first.size
sass_files.each do |sass_file| sass_files.each do |sass_file|
css_file = compiler.corresponding_css_file(sass_file) unless sass_file[0..0] == '_' css_file = compiler.corresponding_css_file(sass_file) unless sass_file[0..0] == '_'
@ -53,12 +56,12 @@ module Compass
end end
rows << row rows << row
end end
rows << [:-] * 7 rows << [:-] * columns
rows << totals.map{|t| t.to_s} rows << totals.map{|t| t.to_s}
rows << [:-] * 7 rows << [:-] * columns
rows.each do |row| rows.each do |row|
row.each_with_index do |col, i| row.each_with_index do |col, i|
print pad(col, maximums[i], :align => alignments[i], :left => delimiters[i].first, :right => delimiters[i].last) print pad(col, maximums[i], :align => alignments[i], :left => delimiters[i].first, :right => delimiters[i].last, :formatter => formatters[i])
end end
print "\n" print "\n"
end end
@ -75,11 +78,23 @@ module Compass
else else
filler = ' ' filler = ' '
end end
c = send(:"format_#{options[:formatter]}", c) if options[:formatter]
spaces = max - c.size spaces = max - c.size
filled = filler * [spaces,0].max filled = filler * [spaces,0].max
"#{options[:left]}#{filled if options[:align] == :right}#{c}#{filled if options[:align] == :left}#{options[:right]}" "#{options[:left]}#{filled if options[:align] == :right}#{c}#{filled if options[:align] == :left}#{options[:right]}"
end end
def format_kb(v)
return v unless v =~ /^\d+$/
v = Integer(v)
if v < 1024
"#{v} B"
else
v = v / 1024.0
"#{v.ceil} KB"
end
end
def sorted_sass_files(compiler) def sorted_sass_files(compiler)
sass_files = compiler.sass_files(:exclude_partials => false) sass_files = compiler.sass_files(:exclude_partials => false)
sass_files.map! do |s| sass_files.map! do |s|
@ -100,7 +115,7 @@ module Compass
def sass_columns(sass_file) def sass_columns(sass_file)
sf = Compass::Stats::SassFile.new(sass_file) sf = Compass::Stats::SassFile.new(sass_file)
sf.analyze! sf.analyze!
%w(rule_count prop_count mixin_def_count mixin_count).map do |t| %w(rule_count prop_count mixin_def_count mixin_count file_size).map do |t|
sf.send(t).to_s sf.send(t).to_s
end end
end end
@ -109,11 +124,11 @@ module Compass
if File.exists?(css_file) if File.exists?(css_file)
cf = Compass::Stats::CssFile.new(css_file) cf = Compass::Stats::CssFile.new(css_file)
cf.analyze! cf.analyze!
%w(selector_count prop_count).map do |t| %w(selector_count prop_count file_size).map do |t|
cf.send(t).to_s cf.send(t).to_s
end end
else else
return [ '--', '--' ] return [ '--', '--' , '--']
end end
rescue LoadError rescue LoadError
@missing_css_parser = true @missing_css_parser = true

View File

@ -8,7 +8,9 @@ module Compass::SassExtensions::Functions::GradientSupport
[color, stop].compact [color, stop].compact
end end
def initialize(color, stop = nil) def initialize(color, stop = nil)
unless Sass::Script::Color === color || Sass::Script::Funcall === color unless Sass::Script::Color === color ||
Sass::Script::Funcall === color ||
(Sass::Script::String === color && color.value == "transparent")
raise Sass::SyntaxError, "Expected a color. Got: #{color}" raise Sass::SyntaxError, "Expected a color. Got: #{color}"
end end
if stop && !stop.is_a?(Sass::Script::Number) if stop && !stop.is_a?(Sass::Script::Number)
@ -19,8 +21,16 @@ module Compass::SassExtensions::Functions::GradientSupport
def inspect def inspect
to_s to_s
end end
def self.color_to_s(c)
if c.is_a?(Sass::Script::String)
c.value.dup
else
c.inspect.dup
end
end
def to_s(options = self.options) def to_s(options = self.options)
s = color.inspect.dup s = self.class.color_to_s(color)
if stop if stop
s << " " s << " "
if stop.unitless? if stop.unitless?
@ -227,13 +237,14 @@ module Compass::SassExtensions::Functions::GradientSupport
def color_stops(*args) def color_stops(*args)
Sass::Script::List.new(args.map do |arg| Sass::Script::List.new(args.map do |arg|
case arg if ColorStop === arg
when ColorStop
arg arg
when Sass::Script::Color elsif Sass::Script::Color === arg
ColorStop.new(arg) ColorStop.new(arg)
when Sass::Script::List elsif Sass::Script::List === arg
ColorStop.new(*arg.value) ColorStop.new(*arg.value)
elsif Sass::Script::String === arg && arg.value == "transparent"
ColorStop.new(arg)
else else
raise Sass::SyntaxError, "Not a valid color stop: #{arg.class.name}: #{arg}" raise Sass::SyntaxError, "Not a valid color stop: #{arg.class.name}: #{arg}"
end end
@ -288,7 +299,7 @@ module Compass::SassExtensions::Functions::GradientSupport
# returns color-stop() calls for use in webkit. # returns color-stop() calls for use in webkit.
def grad_color_stops(color_list) def grad_color_stops(color_list)
stops = color_stops_in_percentages(color_list).map do |stop, color| stops = color_stops_in_percentages(color_list).map do |stop, color|
"color-stop(#{stop.inspect}, #{color.inspect})" "color-stop(#{stop.inspect}, #{ColorStop.color_to_s(color)})"
end end
Sass::Script::String.new(stops.join(", ")) Sass::Script::String.new(stops.join(", "))
end end

View File

@ -29,6 +29,7 @@ module Compass
class CssFile class CssFile
attr_accessor :path, :css attr_accessor :path, :css
attr_accessor :selector_count, :prop_count attr_accessor :selector_count, :prop_count
attr_accessor :file_size
def initialize(path) def initialize(path)
require 'css_parser' require 'css_parser'
self.path = path self.path = path
@ -44,6 +45,7 @@ module Compass
contents.inject(0){|m,c| m + 1 } contents.inject(0){|m,c| m + 1 }
end end
def analyze! def analyze!
self.file_size = File.size(path)
css.each_selector do |selector, declarations, specificity| css.each_selector do |selector, declarations, specificity|
sels = selector.split(/,/).size sels = selector.split(/,/).size
props = declarations.split(/;/).size props = declarations.split(/;/).size
@ -55,6 +57,8 @@ module Compass
class SassFile class SassFile
attr_accessor :path attr_accessor :path
attr_reader :visitor attr_reader :visitor
attr_accessor :file_size
def initialize(path) def initialize(path)
self.path = path self.path = path
end end
@ -72,6 +76,7 @@ module Compass
@visitor @visitor
end end
def analyze! def analyze!
self.file_size = File.size(path)
visit_tree! visit_tree!
end end
def lines def lines

View File

@ -82,15 +82,25 @@
background-image: -ms-linear-gradient(left, #dddddd 10px, #aaaaaa 40px); background-image: -ms-linear-gradient(left, #dddddd 10px, #aaaaaa 40px);
background-image: linear-gradient(left, #dddddd 10px, #aaaaaa 40px); } background-image: linear-gradient(left, #dddddd 10px, #aaaaaa 40px); }
.bg-radial-gradient { .transparent-in-linear-gradient {
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iMTAwIj48c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjZGRkZGRkIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjYWFhYWFhIi8+PC9yYWRpYWxHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); background-image: white url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iInRyYW5zcGFyZW50IiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2FhYWFhYSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
background-size: 100%; background-size: 100%;
background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 100, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); background-image: white -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, transparent), color-stop(100%, #aaaaaa));
background-image: -webkit-radial-gradient(center center, #dddddd, #aaaaaa 100px); background-image: white -webkit-linear-gradient(top left, transparent, #aaaaaa);
background-image: -moz-radial-gradient(center center, #dddddd, #aaaaaa 100px); background-image: white -moz-linear-gradient(top left, transparent, #aaaaaa);
background-image: -o-radial-gradient(center center, #dddddd, #aaaaaa 100px); background-image: white -o-linear-gradient(top left, transparent, #aaaaaa);
background-image: -ms-radial-gradient(center center, #dddddd, #aaaaaa 100px); background-image: white -ms-linear-gradient(top left, transparent, #aaaaaa);
background-image: radial-gradient(center center, #dddddd, #aaaaaa 100px); } background-image: white linear-gradient(top left, transparent, #aaaaaa); }
.transparent-in-linear-gradient {
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iMTAwIj48c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjZGRkZGRkIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIidHJhbnNwYXJlbnQiIi8+PC9yYWRpYWxHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
background-size: 100%;
background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 100, color-stop(0%, #dddddd), color-stop(100%, transparent));
background-image: -webkit-radial-gradient(center center, #dddddd, transparent 100px);
background-image: -moz-radial-gradient(center center, #dddddd, transparent 100px);
background-image: -o-radial-gradient(center center, #dddddd, transparent 100px);
background-image: -ms-radial-gradient(center center, #dddddd, transparent 100px);
background-image: radial-gradient(center center, #dddddd, transparent 100px); }
.bg-linear-gradient-with-angle { .bg-linear-gradient-with-angle {
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9Ii00NSIgeTE9IiIgeDI9Ii00NSIgeTI9IiIgZ3JhZGllbnRUcmFuc2Zvcm0gPSAicm90YXRlKC00NSkiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNkZGRkZGQiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNhYWFhYWEiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyYWQpIiAvPjwvc3ZnPiA='); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9Ii00NSIgeTE9IiIgeDI9Ii00NSIgeTI9IiIgZ3JhZGllbnRUcmFuc2Zvcm0gPSAicm90YXRlKC00NSkiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNkZGRkZGQiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNhYWFhYWEiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyYWQpIiAvPjwvc3ZnPiA=');

View File

@ -31,8 +31,13 @@ $experimental-support-for-svg: true
.bg-linear-gradient-pixel-stop-from-left .bg-linear-gradient-pixel-stop-from-left
+background-image(linear-gradient(left, #ddd 10px, #aaa 40px)) +background-image(linear-gradient(left, #ddd 10px, #aaa 40px))
.transparent-in-linear-gradient
+background-image(#fff linear-gradient(top left, transparent, #aaa))
.transparent-in-linear-gradient
+background-image(radial-gradient(center center, #ddd, transparent 100px))
.bg-radial-gradient .bg-radial-gradient
+background-image(radial-gradient(center center, #ddd, #aaa 100px))
.bg-linear-gradient-with-angle .bg-linear-gradient-with-angle
+background-image(linear-gradient(-45deg, #ddd, #aaa)) +background-image(linear-gradient(-45deg, #ddd, #aaa))
@ -231,3 +236,4 @@ $experimental-support-for-svg: true
.ie-alpha-filter .ie-alpha-filter
+filter-gradient(rgba(#fff, 1), rgba(#fff, 0)) +filter-gradient(rgba(#fff, 1), rgba(#fff, 0))