Merge branch 'master' into rails31

* master:
  Prepare the next release version
  Fix CSS3 background attribute
  Version Bump & Prepare for v0.11.2
  Strong tags in the docs should be bold.
  Fixes sprites file names with sprockets, modifies tests accordingly to new structure.
  removed all cacheing from importer class it causes more problems then it was worth
  gemfile
  removed another instance cache in the importer that could be problematic
  updated importer to validate that sprites are png files
  run bundle exec when running tests
  cleaned up some over zelious cacheing that was causing inconsistancy problems
  added test for sprite importer
  removed unneeded cache
  readded mtime to importer class
  typo: appliction
  Update test case for flexible box.
  Enable IE 10 support for flexible box with the -ms prefix.
This commit is contained in:
Chris Eppstein 2011-06-10 16:00:04 -07:00
commit ba5bec3e09
19 changed files with 181 additions and 85 deletions

View File

@ -4,3 +4,4 @@ rvm:
- jruby - jruby
- rbx - rbx
- ree - ree
script: "bundle exec rake test"

View File

@ -7,7 +7,7 @@ GIT
PATH PATH
remote: . remote: .
specs: specs:
compass (0.11.1.d9e4054) compass (0.11.1.f248c22)
chunky_png (~> 1.1) chunky_png (~> 1.1)
fssm (>= 0.2.7) fssm (>= 0.2.7)
sass (~> 3.1) sass (~> 3.1)
@ -50,7 +50,7 @@ GEM
autotest-fsevent (0.2.5) autotest-fsevent (0.2.5)
sys-uname sys-uname
builder (2.1.2) builder (2.1.2)
chunky_png (1.1.1) chunky_png (1.2.0)
compass-validator (3.0.0) compass-validator (3.0.0)
css_parser (1.0.1) css_parser (1.0.1)
cucumber (0.9.4) cucumber (0.9.4)

View File

@ -1,5 +1,7 @@
--- ---
:major: 0 :major: 0
:minor: 11 :minor: 11
:build: 1 :patch: 3
:state: rc
:build: 0
:name: Antares :name: Antares

View File

@ -14,16 +14,13 @@ The Documentation for the [latest stable release](http://compass-style.org/docs/
The Documentation for the [latest preview release](http://beta.compass-style.org/) The Documentation for the [latest preview release](http://beta.compass-style.org/)
0.11.3 (PENDING) 0.11.2 (06/10/2011)
------------------- -------------------
* Sprites will now by default remove any old versions of the sprite a new variable has been created to override this. * Sprites will now by default remove any old versions of the sprite. A new configuration
variable has been created to override this.
* Nested sprites are now supported using globs `@import 'nested/**/*.png';`. * Nested sprites are now supported using globs `@import 'nested/**/*.png';`.
* Fixed a bug that was causing sprite variable options to not get passed to the image classes. * Fixed a bug that was causing sprite variable options to not get passed to the image classes.
* Sass Colors will no longer cause an error if you use them as sprite names. * Sass Colors will no longer cause an error if you use them as sprite names.
0.11.2 (05/01/2011)
-------------------
* Added support for -ms gradients in background-image and background properties * Added support for -ms gradients in background-image and background properties
* Give a better error if Sass::Script::Functions.declare does not exist. * Give a better error if Sass::Script::Functions.declare does not exist.

View File

@ -1,7 +1,7 @@
--- ---
title: Application Integration title: Application Integration
layout: tutorial layout: tutorial
crumb: Appliction Integration crumb: Application Integration
classnames: classnames:
- tutorial - tutorial
--- ---

View File

@ -25,7 +25,7 @@ classnames:
Example (more examples are available by following the links below): Example (more examples are available by following the links below):
<pre><code class="source-code scss">.in-css3 { <pre><code class="source-code scss">.in-css3 {
background: image-url("foo.png"), background: url(foo.png),
linear-gradient(top left, #333, #0c0), linear-gradient(top left, #333, #0c0),
radial-gradient(#c00, #fff 100px); radial-gradient(#c00, #fff 100px);
} }

View File

@ -3,7 +3,7 @@
// display:box; must be used for any of the other flexbox mixins to work properly // display:box; must be used for any of the other flexbox mixins to work properly
@mixin display-box { @mixin display-box {
@include experimental-value(display, box, @include experimental-value(display, box,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -16,7 +16,7 @@ $default-box-orient: horizontal !default;
) { ) {
$orientation : unquote($orientation); $orientation : unquote($orientation);
@include experimental(box-orient, $orientation, @include experimental(box-orient, $orientation,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -29,7 +29,7 @@ $default-box-align: stretch !default;
) { ) {
$alignment : unquote($alignment); $alignment : unquote($alignment);
@include experimental(box-align, $alignment, @include experimental(box-align, $alignment,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -43,7 +43,7 @@ $default-box-flex: 0 !default;
$flex: $default-box-flex $flex: $default-box-flex
) { ) {
@include experimental(box-flex, $flex, @include experimental(box-flex, $flex,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -55,7 +55,7 @@ $default-box-flex-group: 1 !default;
$group: $default-box-flex-group $group: $default-box-flex-group
) { ) {
@include experimental(box-flex-group, $group, @include experimental(box-flex-group, $group,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -67,7 +67,7 @@ $default-box-ordinal-group: 1 !default;
$group: $default-ordinal-flex-group $group: $default-ordinal-flex-group
) { ) {
@include experimental(box-ordinal-group, $group, @include experimental(box-ordinal-group, $group,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -80,7 +80,7 @@ $default-box-direction: normal !default;
) { ) {
$direction: unquote($direction); $direction: unquote($direction);
@include experimental(box-direction, $direction, @include experimental(box-direction, $direction,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -93,7 +93,7 @@ $default-box-lines: single !default;
) { ) {
$lines: unquote($lines); $lines: unquote($lines);
@include experimental(box-lines, $lines, @include experimental(box-lines, $lines,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }
@ -106,6 +106,6 @@ $default-box-pack: start !default;
) { ) {
$pack: unquote($pack); $pack: unquote($pack);
@include experimental(box-pack, $pack, @include experimental(box-pack, $pack,
-moz, -webkit, not -o, not -ms, not -khtml, official -moz, -webkit, not -o, -ms, not -khtml, official
); );
} }

View File

@ -96,7 +96,7 @@ module Compass::SassExtensions::Functions::Sprites
def sprite_url(map) def sprite_url(map)
verify_map(map, "sprite-url") verify_map(map, "sprite-url")
map.generate map.generate
image_url(Sass::Script::String.new("#{map.path}-#{map.uniqueness_hash}.png"), image_url(Sass::Script::String.new("#{map.path}-s#{map.uniqueness_hash}.png"),
Sass::Script::Bool.new(false), Sass::Script::Bool.new(false),
Sass::Script::Bool.new(false)) Sass::Script::Bool.new(false))
end end

View File

@ -114,7 +114,7 @@ module Compass
# The on-the-disk filename of the sprite # The on-the-disk filename of the sprite
def filename def filename
File.join(Compass.configuration.images_path, "#{path}-#{uniqueness_hash}.png") File.join(Compass.configuration.images_path, "#{path}-s#{uniqueness_hash}.png")
end end
# Generate a sprite image if necessary # Generate a sprite image if necessary

View File

@ -3,13 +3,12 @@ module Compass
attr_accessor :uri, :options attr_accessor :uri, :options
VAILD_FILE_NAME = /\A#{Sass::SCSS::RX::IDENT}\Z/ VAILD_FILE_NAME = /\A#{Sass::SCSS::RX::IDENT}\Z/
SPRITE_IMPORTER_REGEX = %r{((.+/)?([^\*.]+))/(.+?)\.png} SPRITE_IMPORTER_REGEX = %r{((.+/)?([^\*.]+))/(.+?)\.png}
VALID_EXTENSIONS = ['.png']
def self.load(uri, options) def self.load(uri, options)
Compass.quick_cache "Sprite_map:#{uri}#{options.inspect}", 5 do klass = Compass::SpriteImporter.new
klass = Compass::SpriteImporter.new klass.uri, klass.options = uri, options
klass.uri, klass.options = uri, options klass
klass
end
end end
def initialize(options ={}) def initialize(options ={})
@ -43,7 +42,12 @@ module Compass
other.class == self.class other.class == self.class
end end
def mtime(uri, options)
@uri, @options = uri, options
files.sort.inject(Time.at(0)) do |max_time, file|
(t = File.mtime(file)) > max_time ? t : max_time
end
end
def key(uri, options={}) def key(uri, options={})
@uri, @options = uri, options @uri, @options = uri, options
@ -51,12 +55,10 @@ module Compass
end end
def self.path_and_name(uri) def self.path_and_name(uri)
Compass.quick_cache "Sprite_map_name:#{uri}", 5 do if uri =~ SPRITE_IMPORTER_REGEX
if uri =~ SPRITE_IMPORTER_REGEX [$1, $3]
[$1, $3] else
else raise Compass::Error "invalid sprite path"
[nil, nil]
end
end end
end end
@ -74,12 +76,12 @@ module Compass
# Returns the Glob of image files for this sprite # Returns the Glob of image files for this sprite
def files def files
@files ||= Dir[File.join(Compass.configuration.images_path, uri)].sort Dir[File.join(Compass.configuration.images_path, uri)].sort
end end
# Returns an Array of image names without the file extension # Returns an Array of image names without the file extension
def sprite_names def sprite_names
@sprite_names ||= files.collect do |file| files.collect do |file|
filename = File.basename(file, '.png') filename = File.basename(file, '.png')
unless VAILD_FILE_NAME =~ filename unless VAILD_FILE_NAME =~ filename
raise Compass::Error, "Sprite file names must be legal css identifiers. Please rename #{File.basename(file)}" raise Compass::Error, "Sprite file names must be legal css identifiers. Please rename #{File.basename(file)}"
@ -88,13 +90,22 @@ module Compass
end end
end end
def validate_sprites!
files.each do |file|
unless VALID_EXTENSIONS.include? File.extname(file)
raise Compass::Error, "Invalid sprite extension only: #{VALID_EXTENSIONS.join(',')} images are allowed"
end
end
end
# Returns the sass options for this sprite # Returns the sass options for this sprite
def sass_options def sass_options
@sass_options ||= options.merge(:filename => name, :syntax => :scss, :importer => self) options.merge(:filename => name, :syntax => :scss, :importer => self)
end end
# Returns a Sass::Engine for this sprite object # Returns a Sass::Engine for this sprite object
def sass_engine def sass_engine
validate_sprites!
Sass::Engine.new(content_for_images, sass_options) Sass::Engine.new(content_for_images, sass_options)
end end

View File

@ -27,7 +27,7 @@ describe Compass::SassExtensions::Sprites::Base do
its(:generation_required?) { should be_true } its(:generation_required?) { should be_true }
its(:uniqueness_hash) { should == 'ef52c5c63a'} its(:uniqueness_hash) { should == 'ef52c5c63a'}
its(:outdated?) { should be_true } its(:outdated?) { should be_true }
its(:filename) { should == File.join(@images_tmp_path, "#{@base.path}-#{@base.uniqueness_hash}.png")} its(:filename) { should == File.join(@images_tmp_path, "#{@base.path}-s#{@base.uniqueness_hash}.png")}
it "should return the 'ten-by-ten' image" do it "should return the 'ten-by-ten' image" do
subject.image_for('ten-by-ten').name.should == 'ten-by-ten' subject.image_for('ten-by-ten').name.should == 'ten-by-ten'

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,84 +1,103 @@
.hbox { .hbox {
display: -moz-box; display: -moz-box;
display: -webkit-box; display: -webkit-box;
display: -ms-box;
display: box; display: box;
-moz-box-orient: horizontal; -moz-box-orient: horizontal;
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
-ms-box-orient: horizontal;
box-orient: horizontal; box-orient: horizontal;
-moz-box-align: stretch; -moz-box-align: stretch;
-webkit-box-align: stretch; -webkit-box-align: stretch;
-ms-box-align: stretch;
box-align: stretch; } box-align: stretch; }
.hbox > * { .hbox > * {
-moz-box-flex: 0; -moz-box-flex: 0;
-webkit-box-flex: 0; -webkit-box-flex: 0;
-ms-box-flex: 0;
box-flex: 0; } box-flex: 0; }
.vbox { .vbox {
display: -moz-box; display: -moz-box;
display: -webkit-box; display: -webkit-box;
display: -ms-box;
display: box; display: box;
-moz-box-orient: vertical; -moz-box-orient: vertical;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-ms-box-orient: vertical;
box-orient: vertical; box-orient: vertical;
-moz-box-align: stretch; -moz-box-align: stretch;
-webkit-box-align: stretch; -webkit-box-align: stretch;
-ms-box-align: stretch;
box-align: stretch; } box-align: stretch; }
.vbox > * { .vbox > * {
-moz-box-flex: 0; -moz-box-flex: 0;
-webkit-box-flex: 0; -webkit-box-flex: 0;
-ms-box-flex: 0;
box-flex: 0; } box-flex: 0; }
.spacer { .spacer {
-moz-box-flex: 1; -moz-box-flex: 1;
-webkit-box-flex: 1; -webkit-box-flex: 1;
-ms-box-flex: 1;
box-flex: 1; } box-flex: 1; }
.reverse { .reverse {
-moz-box-direction: reverse; -moz-box-direction: reverse;
-webkit-box-direction: reverse; -webkit-box-direction: reverse;
-ms-box-direction: reverse;
box-direction: reverse; } box-direction: reverse; }
.box-flex-0 { .box-flex-0 {
-moz-box-flex: 0; -moz-box-flex: 0;
-webkit-box-flex: 0; -webkit-box-flex: 0;
-ms-box-flex: 0;
box-flex: 0; } box-flex: 0; }
.box-flex-1 { .box-flex-1 {
-moz-box-flex: 1; -moz-box-flex: 1;
-webkit-box-flex: 1; -webkit-box-flex: 1;
-ms-box-flex: 1;
box-flex: 1; } box-flex: 1; }
.box-flex-2 { .box-flex-2 {
-moz-box-flex: 2; -moz-box-flex: 2;
-webkit-box-flex: 2; -webkit-box-flex: 2;
-ms-box-flex: 2;
box-flex: 2; } box-flex: 2; }
.box-flex-group-0 { .box-flex-group-0 {
-moz-box-flex-group: 0; -moz-box-flex-group: 0;
-webkit-box-flex-group: 0; -webkit-box-flex-group: 0;
-ms-box-flex-group: 0;
box-flex-group: 0; } box-flex-group: 0; }
.box-flex-group-1 { .box-flex-group-1 {
-moz-box-flex-group: 1; -moz-box-flex-group: 1;
-webkit-box-flex-group: 1; -webkit-box-flex-group: 1;
-ms-box-flex-group: 1;
box-flex-group: 1; } box-flex-group: 1; }
.box-flex-group-2 { .box-flex-group-2 {
-moz-box-flex-group: 2; -moz-box-flex-group: 2;
-webkit-box-flex-group: 2; -webkit-box-flex-group: 2;
-ms-box-flex-group: 2;
box-flex-group: 2; } box-flex-group: 2; }
.start { .start {
-moz-box-pack: start; -moz-box-pack: start;
-webkit-box-pack: start; -webkit-box-pack: start;
-ms-box-pack: start;
box-pack: start; } box-pack: start; }
.end { .end {
-moz-box-pack: end; -moz-box-pack: end;
-webkit-box-pack: end; -webkit-box-pack: end;
-ms-box-pack: end;
box-pack: end; } box-pack: end; }
.center { .center {
-moz-box-pack: center; -moz-box-pack: center;
-webkit-box-pack: center; -webkit-box-pack: center;
-ms-box-pack: center;
box-pack: center; } box-pack: center; }

View File

@ -1,5 +1,5 @@
.flag-sprite, #flags .us, #flags .au, #flags .ca, #flags .es, #flags .eg, #flags .ly, .flag-ad, .flag-ae, .flag-af, .flag-ag, .flag-ai, .flag-al, .flag-am, .flag-an, .flag-ao, .flag-ar, .flag-as, .flag-at, .flag-au, .flag-aw, .flag-ax, .flag-az, .flag-ba, .flag-bb, .flag-bd, .flag-be, .flag-bf, .flag-bg, .flag-bh, .flag-bi, .flag-bj, .flag-bm, .flag-bn, .flag-bo, .flag-br, .flag-bs, .flag-bt, .flag-bv, .flag-bw, .flag-by, .flag-bz, .flag-ca, .flag-catalonia, .flag-cc, .flag-cd, .flag-cf, .flag-cg, .flag-ch, .flag-ci, .flag-ck, .flag-cl, .flag-cm, .flag-cn, .flag-co, .flag-cr, .flag-cs, .flag-cu, .flag-cv, .flag-cx, .flag-cy, .flag-cz, .flag-de, .flag-dj, .flag-dk, .flag-dm, .flag-do, .flag-dz, .flag-ec, .flag-ee, .flag-eg, .flag-eh, .flag-england, .flag-er, .flag-es, .flag-et, .flag-europeanunion, .flag-fam, .flag-fi, .flag-fj, .flag-fk, .flag-fm, .flag-fo, .flag-fr, .flag-ga, .flag-gb, .flag-gd, .flag-ge, .flag-gf, .flag-gh, .flag-gi, .flag-gl, .flag-gm, .flag-gn, .flag-gp, .flag-gq, .flag-gr, .flag-gs, .flag-gt, .flag-gu, .flag-gw, .flag-gy, .flag-hk, .flag-hm, .flag-hn, .flag-hr, .flag-ht, .flag-hu, .flag-id-2, .flag-ie, .flag-il, .flag-in, .flag-io, .flag-iq, .flag-ir, .flag-is, .flag-it, .flag-jm, .flag-jo, .flag-jp, .flag-ke, .flag-kg, .flag-kh, .flag-ki, .flag-km, .flag-kn, .flag-kp, .flag-kr, .flag-kw, .flag-ky, .flag-kz, .flag-la, .flag-lb, .flag-lc, .flag-li, .flag-lk, .flag-lr, .flag-ls, .flag-lt, .flag-lu, .flag-lv, .flag-ly, .flag-ma, .flag-mc, .flag-md, .flag-me, .flag-mg, .flag-mh, .flag-mk, .flag-ml, .flag-mm, .flag-mn, .flag-mo, .flag-mp, .flag-mq, .flag-mr, .flag-ms, .flag-mt, .flag-mu, .flag-mv, .flag-mw, .flag-mx, .flag-my, .flag-mz, .flag-na, .flag-nc, .flag-ne, .flag-nf, .flag-ng, .flag-ni, .flag-nl, .flag-no, .flag-np, .flag-nr, .flag-nu, .flag-nz, .flag-om, .flag-pa, .flag-pe, .flag-pf, .flag-pg, .flag-ph, .flag-pk, .flag-pl, .flag-pm, .flag-pn, .flag-pr, .flag-ps, .flag-pt, .flag-pw, .flag-py, .flag-qa, .flag-re, .flag-ro, .flag-rs, .flag-ru, .flag-rw, .flag-sa, .flag-sb, .flag-sc, .flag-scotland, .flag-sd, .flag-se, .flag-sg, .flag-sh, .flag-si, .flag-sj, .flag-sk, .flag-sl, .flag-sm, .flag-sn, .flag-so, .flag-sr, .flag-st, .flag-sv, .flag-sy, .flag-sz, .flag-tc, .flag-td, .flag-tf, .flag-tg, .flag-th, .flag-tj, .flag-tk, .flag-tl, .flag-tm, .flag-tn, .flag-to, .flag-tr, .flag-tt, .flag-tv, .flag-tw, .flag-tz, .flag-ua, .flag-ug, .flag-um, .flag-us, .flag-uy, .flag-uz, .flag-va, .flag-vc, .flag-ve, .flag-vg, .flag-vi, .flag-vn, .flag-vu, .flag-wales, .flag-wf, .flag-ws, .flag-ye, .flag-yt, .flag-za, .flag-zm, .flag-zw { .flag-sprite, #flags .us, #flags .au, #flags .ca, #flags .es, #flags .eg, #flags .ly, .flag-ad, .flag-ae, .flag-af, .flag-ag, .flag-ai, .flag-al, .flag-am, .flag-an, .flag-ao, .flag-ar, .flag-as, .flag-at, .flag-au, .flag-aw, .flag-ax, .flag-az, .flag-ba, .flag-bb, .flag-bd, .flag-be, .flag-bf, .flag-bg, .flag-bh, .flag-bi, .flag-bj, .flag-bm, .flag-bn, .flag-bo, .flag-br, .flag-bs, .flag-bt, .flag-bv, .flag-bw, .flag-by, .flag-bz, .flag-ca, .flag-catalonia, .flag-cc, .flag-cd, .flag-cf, .flag-cg, .flag-ch, .flag-ci, .flag-ck, .flag-cl, .flag-cm, .flag-cn, .flag-co, .flag-cr, .flag-cs, .flag-cu, .flag-cv, .flag-cx, .flag-cy, .flag-cz, .flag-de, .flag-dj, .flag-dk, .flag-dm, .flag-do, .flag-dz, .flag-ec, .flag-ee, .flag-eg, .flag-eh, .flag-england, .flag-er, .flag-es, .flag-et, .flag-europeanunion, .flag-fam, .flag-fi, .flag-fj, .flag-fk, .flag-fm, .flag-fo, .flag-fr, .flag-ga, .flag-gb, .flag-gd, .flag-ge, .flag-gf, .flag-gh, .flag-gi, .flag-gl, .flag-gm, .flag-gn, .flag-gp, .flag-gq, .flag-gr, .flag-gs, .flag-gt, .flag-gu, .flag-gw, .flag-gy, .flag-hk, .flag-hm, .flag-hn, .flag-hr, .flag-ht, .flag-hu, .flag-id-2, .flag-ie, .flag-il, .flag-in, .flag-io, .flag-iq, .flag-ir, .flag-is, .flag-it, .flag-jm, .flag-jo, .flag-jp, .flag-ke, .flag-kg, .flag-kh, .flag-ki, .flag-km, .flag-kn, .flag-kp, .flag-kr, .flag-kw, .flag-ky, .flag-kz, .flag-la, .flag-lb, .flag-lc, .flag-li, .flag-lk, .flag-lr, .flag-ls, .flag-lt, .flag-lu, .flag-lv, .flag-ly, .flag-ma, .flag-mc, .flag-md, .flag-me, .flag-mg, .flag-mh, .flag-mk, .flag-ml, .flag-mm, .flag-mn, .flag-mo, .flag-mp, .flag-mq, .flag-mr, .flag-ms, .flag-mt, .flag-mu, .flag-mv, .flag-mw, .flag-mx, .flag-my, .flag-mz, .flag-na, .flag-nc, .flag-ne, .flag-nf, .flag-ng, .flag-ni, .flag-nl, .flag-no, .flag-np, .flag-nr, .flag-nu, .flag-nz, .flag-om, .flag-pa, .flag-pe, .flag-pf, .flag-pg, .flag-ph, .flag-pk, .flag-pl, .flag-pm, .flag-pn, .flag-pr, .flag-ps, .flag-pt, .flag-pw, .flag-py, .flag-qa, .flag-re, .flag-ro, .flag-rs, .flag-ru, .flag-rw, .flag-sa, .flag-sb, .flag-sc, .flag-scotland, .flag-sd, .flag-se, .flag-sg, .flag-sh, .flag-si, .flag-sj, .flag-sk, .flag-sl, .flag-sm, .flag-sn, .flag-so, .flag-sr, .flag-st, .flag-sv, .flag-sy, .flag-sz, .flag-tc, .flag-td, .flag-tf, .flag-tg, .flag-th, .flag-tj, .flag-tk, .flag-tl, .flag-tm, .flag-tn, .flag-to, .flag-tr, .flag-tt, .flag-tv, .flag-tw, .flag-tz, .flag-ua, .flag-ug, .flag-um, .flag-us, .flag-uy, .flag-uz, .flag-va, .flag-vc, .flag-ve, .flag-vg, .flag-vi, .flag-vn, .flag-vu, .flag-wales, .flag-wf, .flag-ws, .flag-ye, .flag-yt, .flag-za, .flag-zm, .flag-zw {
background: url('/images/flag-03c3b29b35.png') no-repeat; } background: url('/images/flag-s03c3b29b35.png') no-repeat; }
#flags .us { #flags .us {
background-position: 0 -2520px; background-position: 0 -2520px;

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -59,7 +59,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-161c60ad78.png') no-repeat; background: url('/squares-s161c60ad78.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -70,8 +70,8 @@ class SpritesTest < Test::Unit::TestCase
background-position: 0 -10px; background-position: 0 -10px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 30] assert_equal image_size('squares-s*.png'), [20, 30]
assert_equal image_md5('squares-*.png'), 'fcc93d7b279c2ad6898fbca49cbd01e1' assert_equal image_md5('squares-s*.png'), 'fcc93d7b279c2ad6898fbca49cbd01e1'
end end
it "should generate sprite classes with dimensions" do it "should generate sprite classes with dimensions" do
@ -82,7 +82,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-161c60ad78.png') no-repeat; background: url('/squares-s161c60ad78.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -97,7 +97,7 @@ class SpritesTest < Test::Unit::TestCase
width: 20px; width: 20px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 30] assert_equal image_size('squares-s*.png'), [20, 30]
end end
it "should provide sprite mixin" do it "should provide sprite mixin" do
@ -114,7 +114,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .cubicle, .large-cube { .squares-sprite, .cubicle, .large-cube {
background: url('/squares-161c60ad78.png') no-repeat; background: url('/squares-s161c60ad78.png') no-repeat;
} }
.cubicle { .cubicle {
@ -127,7 +127,7 @@ class SpritesTest < Test::Unit::TestCase
width: 20px; width: 20px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 30] assert_equal image_size('squares-s*.png'), [20, 30]
end end
# CUSTOMIZATIONS: # CUSTOMIZATIONS:
@ -139,10 +139,10 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.circles { .circles {
background: url('/squares-161c60ad78.png') no-repeat; background: url('/squares-s161c60ad78.png') no-repeat;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 30] assert_equal image_size('squares-s*.png'), [20, 30]
end end
it "should calculate the spacing between images but not before first image" do it "should calculate the spacing between images but not before first image" do
@ -153,7 +153,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-89450808af.png') no-repeat; background: url('/squares-s89450808af.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -164,7 +164,7 @@ class SpritesTest < Test::Unit::TestCase
background-position: 0 -43px; background-position: 0 -43px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 63] assert_equal image_size('squares-s*.png'), [20, 63]
end end
it "should calculate the spacing between images" do it "should calculate the spacing between images" do
@ -175,7 +175,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-673837183a.png') no-repeat; background: url('/squares-s673837183a.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -186,7 +186,7 @@ class SpritesTest < Test::Unit::TestCase
background-position: 0 -43px; background-position: 0 -43px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 63] assert_equal image_size('squares-s*.png'), [20, 63]
end end
it "should calculate the maximum spacing between images" do it "should calculate the maximum spacing between images" do
@ -198,7 +198,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-1cd84c9068.png') no-repeat; background: url('/squares-s1cd84c9068.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -209,7 +209,7 @@ class SpritesTest < Test::Unit::TestCase
background-position: 0 -54px; background-position: 0 -54px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 74] assert_equal image_size('squares-s*.png'), [20, 74]
end end
it "should calculate the maximum spacing between images in reversed order" do it "should calculate the maximum spacing between images in reversed order" do
@ -221,7 +221,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-f25b7090ca.png') no-repeat; background: url('/squares-sf25b7090ca.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -232,7 +232,7 @@ class SpritesTest < Test::Unit::TestCase
background-position: 0 -54px; background-position: 0 -54px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 74] assert_equal image_size('squares-s*.png'), [20, 74]
end end
it "should calculate the default spacing between images" do it "should calculate the default spacing between images" do
@ -243,7 +243,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-d66bf24bab.png') no-repeat; background: url('/squares-sd66bf24bab.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -254,7 +254,7 @@ class SpritesTest < Test::Unit::TestCase
background-position: 0 -32px; background-position: 0 -32px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 52] assert_equal image_size('squares-s*.png'), [20, 52]
end end
it "should use position adjustments in functions" do it "should use position adjustments in functions" do
@ -278,7 +278,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite { .squares-sprite {
background: url('/squares-8e490168dd.png') no-repeat; background: url('/squares-s8e490168dd.png') no-repeat;
} }
.adjusted-percentage { .adjusted-percentage {
@ -293,8 +293,8 @@ class SpritesTest < Test::Unit::TestCase
background-position: -3px -8px; background-position: -3px -8px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 30] assert_equal image_size('squares-s*.png'), [20, 30]
assert_equal image_md5('squares-*.png'), '652b67f5e9092520d6f26caae7e18012' assert_equal image_md5('squares-s*.png'), '652b67f5e9092520d6f26caae7e18012'
end end
it "should use position adjustments in mixins" do it "should use position adjustments in mixins" do
@ -316,7 +316,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .adjusted-percentage, .adjusted-px-1, .adjusted-px-2 { .squares-sprite, .adjusted-percentage, .adjusted-px-1, .adjusted-px-2 {
background: url('/squares-8e490168dd.png') no-repeat; background: url('/squares-s8e490168dd.png') no-repeat;
} }
.adjusted-percentage { .adjusted-percentage {
@ -331,8 +331,8 @@ class SpritesTest < Test::Unit::TestCase
background-position: -3px -8px; background-position: -3px -8px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 30] assert_equal image_size('squares-s*.png'), [20, 30]
assert_equal image_md5('squares-*.png'), '652b67f5e9092520d6f26caae7e18012' assert_equal image_md5('squares-s*.png'), '652b67f5e9092520d6f26caae7e18012'
end end
it "should repeat the image" do it "should repeat the image" do
@ -343,7 +343,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-a5550fd132.png') no-repeat; background: url('/squares-sa5550fd132.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -354,8 +354,8 @@ class SpritesTest < Test::Unit::TestCase
background-position: 0 -10px; background-position: 0 -10px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [20, 30] assert_equal image_size('squares-s*.png'), [20, 30]
assert_equal image_md5('squares-*.png'), '94abae8440f1b58617f52920b70aaed2' assert_equal image_md5('squares-s*.png'), '94abae8440f1b58617f52920b70aaed2'
end end
it "should allow the position of a sprite to be specified in absolute pixels" do it "should allow the position of a sprite to be specified in absolute pixels" do
@ -367,7 +367,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty { .squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
background: url('/squares-89a274044e.png') no-repeat; background: url('/squares-s89a274044e.png') no-repeat;
} }
.squares-ten-by-ten { .squares-ten-by-ten {
@ -378,8 +378,8 @@ class SpritesTest < Test::Unit::TestCase
background-position: -10px -10px; background-position: -10px -10px;
} }
CSS CSS
assert_equal image_size('squares-*.png'), [30, 30] assert_equal image_size('squares-s*.png'), [30, 30]
assert_equal image_md5('squares-*.png'), '2fb19ef9c83018c93c6f147af3a56cb2' assert_equal image_md5('squares-s*.png'), '2fb19ef9c83018c93c6f147af3a56cb2'
end end
it "should provide a nice errors for lemonade's old users" do it "should provide a nice errors for lemonade's old users" do
@ -416,7 +416,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares { .squares {
background: url('/squares-145869726f.png') 0 -10px no-repeat; background: url('/squares-s145869726f.png') 0 -10px no-repeat;
} }
CSS CSS
end end
@ -432,10 +432,10 @@ class SpritesTest < Test::Unit::TestCase
@include sprite-background-position($squares-sprites, "ten-by-ten"); @include sprite-background-position($squares-sprites, "ten-by-ten");
} }
SCSS SCSS
assert_equal image_size('squares-*.png'), [20, 40] assert_equal image_size('squares-s*.png'), [20, 40]
assert_correct css, <<-CSS assert_correct css, <<-CSS
.squares-sprite { .squares-sprite {
background: url('/squares-e3c68372d9.png') no-repeat; background: url('/squares-se3c68372d9.png') no-repeat;
} }
.foo { .foo {
@ -455,7 +455,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.selectors-sprite, .selectors-ten-by-ten { .selectors-sprite, .selectors-ten-by-ten {
background: url('/selectors-edfef809e2.png') no-repeat; background: url('/selectors-sedfef809e2.png') no-repeat;
} }
.selectors-ten-by-ten { .selectors-ten-by-ten {
@ -482,7 +482,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.selectors-sprite, a { .selectors-sprite, a {
background: url('/selectors-edfef809e2.png') no-repeat; background: url('/selectors-sedfef809e2.png') no-repeat;
} }
a { a {
@ -510,7 +510,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.selectors-sprite, a { .selectors-sprite, a {
background: url('/selectors-edfef809e2.png') no-repeat; background: url('/selectors-sedfef809e2.png') no-repeat;
} }
a { a {
@ -538,7 +538,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.ko-sprite, .ko-default_background, .ko-starbg26x27 { .ko-sprite, .ko-default_background, .ko-starbg26x27 {
background: url('/ko-cc3f80660d.png') no-repeat; background: url('/ko-scc3f80660d.png') no-repeat;
} }
.ko-default_background { .ko-default_background {
@ -552,8 +552,8 @@ class SpritesTest < Test::Unit::TestCase
end end
it "should generate a sprite and remove the old file" do it "should generate a sprite and remove the old file" do
FileUtils.touch File.join(@images_tmp_path, "selectors-cc8834Fdd.png") FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Fdd.png")
assert_equal 1, map_files('selectors-*.png').size assert_equal 1, map_files('selectors-s*.png').size
css = render <<-SCSS css = render <<-SCSS
@import "selectors/*.png"; @import "selectors/*.png";
a { a {
@ -561,12 +561,12 @@ class SpritesTest < Test::Unit::TestCase
@include selectors-sprite(ten-by-ten) @include selectors-sprite(ten-by-ten)
} }
SCSS SCSS
assert_equal 1, map_files('selectors-*.png').size, "File was not removed" assert_equal 1, map_files('selectors-s*.png').size, "File was not removed"
end end
it "should generate a sprite and NOT remove the old file" do it "should generate a sprite and NOT remove the old file" do
FileUtils.touch File.join(@images_tmp_path, "selectors-cc8834Ftest.png") FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Ftest.png")
assert_equal 1, map_files('selectors-*.png').size assert_equal 1, map_files('selectors-s*.png').size
css = render <<-SCSS css = render <<-SCSS
$selectors-clean-up: false; $selectors-clean-up: false;
@import "selectors/*.png"; @import "selectors/*.png";
@ -575,7 +575,7 @@ class SpritesTest < Test::Unit::TestCase
@include selectors-sprite(ten-by-ten) @include selectors-sprite(ten-by-ten)
} }
SCSS SCSS
assert_equal 2, map_files('selectors-*.png').size, "File was removed" assert_equal 2, map_files('selectors-s*.png').size, "File was removed"
end end
it "should generate a sprite if the sprite is a colorname" do it "should generate a sprite if the sprite is a colorname" do
@ -595,7 +595,7 @@ class SpritesTest < Test::Unit::TestCase
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS
.nested-sprite, .nested-ten-by-ten { .nested-sprite, .nested-ten-by-ten {
background: url('/nested-55a8935544.png') no-repeat; background: url('/nested-s55a8935544.png') no-repeat;
} }
.nested-ten-by-ten { .nested-ten-by-ten {

View File

@ -0,0 +1,66 @@
require 'test_helper'
require 'timecop'
class ImporterTest < Test::Unit::TestCase
URI = "selectors/*.png"
def setup
@images_src_path = File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'sprites', 'public', 'images')
file = StringIO.new("images_path = #{@images_src_path.inspect}\n")
Compass.add_configuration(file, "sprite_config")
@importer = Compass::SpriteImporter.new(:uri => URI, :options => options)
end
def options
{:foo => 'bar'}
end
test "load should return an instance of SpriteImporter" do
assert Compass::SpriteImporter.load(URI, options).is_a?(Compass::SpriteImporter)
end
test "name should return the sprite name" do
assert_equal 'selectors', @importer.name
end
test "path should return the sprite path" do
assert_equal 'selectors', @importer.path
end
test "should return all the sprite names" do
assert_equal ["ten-by-ten", "ten-by-ten_active", "ten-by-ten_hover", "ten-by-ten_target"], @importer.sprite_names
end
test "should have correct mtime" do
thirtydays = Time.now.to_i + (60*60*24*30)
file = Dir[File.join(@images_src_path, URI)].sort.first
File.utime(thirtydays, thirtydays, file)
assert_equal thirtydays, File.mtime(file).to_i
assert_equal thirtydays, @importer.mtime(URI, {}).to_i
end
test "should return sass engine on find" do
assert @importer.find(URI, {}).is_a?(Sass::Engine)
end
test "sass options should contain options" do
assert_equal 'bar', @importer.sass_options[:foo]
end
test "should fail givin bad sprite extensions" do
@images_src_path = File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'sprites', 'public', 'images')
file = StringIO.new("images_path = #{@images_src_path.inspect}\n")
Compass.add_configuration(file, "sprite_config")
importer = Compass::SpriteImporter.new(:uri => 'bad_extensions/*.jpg', :options => options)
begin
importer.sass_engine
assert false, "Somthing happened an invalid sprite file made it past validation"
rescue Compass::Error => e
assert e.message.include?('.png')
end
end
def taredown
Compass.reset_configuration!
end
end

View File

@ -49,7 +49,7 @@ class SpriteMapTest < Test::Unit::TestCase
end end
it 'should have correct filename' do it 'should have correct filename' do
assert_equal File.join(@images_tmp_path, "#{@base.path}-#{@base.uniqueness_hash}.png"), @base.filename assert_equal File.join(@images_tmp_path, "#{@base.path}-s#{@base.uniqueness_hash}.png"), @base.filename
end end
it "should return the 'ten-by-ten' image" do it "should return the 'ten-by-ten' image" do