diff --git a/lib/compass/sass_extensions/functions/sprites.rb b/lib/compass/sass_extensions/functions/sprites.rb index 0bd54ff5..d746ed28 100644 --- a/lib/compass/sass_extensions/functions/sprites.rb +++ b/lib/compass/sass_extensions/functions/sprites.rb @@ -96,7 +96,7 @@ module Compass::SassExtensions::Functions::Sprites def sprite_url(map) verify_map(map, "sprite-url") 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)) end diff --git a/lib/compass/sass_extensions/sprites/sprite_map.rb b/lib/compass/sass_extensions/sprites/sprite_map.rb index 2bdf905c..bf1e813d 100644 --- a/lib/compass/sass_extensions/sprites/sprite_map.rb +++ b/lib/compass/sass_extensions/sprites/sprite_map.rb @@ -114,7 +114,7 @@ module Compass # The on-the-disk filename of the sprite def filename - File.join(Compass.configuration.images_path, "#{path}-#{uniqueness_hash}.png") + File.join(Compass.configuration.images_path, "#{path}-s#{uniqueness_hash}.png") end # Generate a sprite image if necessary diff --git a/spec/compass/sass_extensions/sprites/base_spec.rb b/spec/compass/sass_extensions/sprites/base_spec.rb index 1d8cfedc..4769e172 100644 --- a/spec/compass/sass_extensions/sprites/base_spec.rb +++ b/spec/compass/sass_extensions/sprites/base_spec.rb @@ -27,7 +27,7 @@ describe Compass::SassExtensions::Sprites::Base do its(:generation_required?) { should be_true } its(:uniqueness_hash) { should == 'ef52c5c63a'} 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 subject.image_for('ten-by-ten').name.should == 'ten-by-ten' diff --git a/test/fixtures/stylesheets/compass/css/sprites.css b/test/fixtures/stylesheets/compass/css/sprites.css index 5415329a..c31df2fa 100644 --- a/test/fixtures/stylesheets/compass/css/sprites.css +++ b/test/fixtures/stylesheets/compass/css/sprites.css @@ -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 { - background: url('/images/flag-03c3b29b35.png') no-repeat; } + background: url('/images/flag-s03c3b29b35.png') no-repeat; } #flags .us { background-position: 0 -2520px; diff --git a/test/fixtures/stylesheets/compass/images/flag-03c3b29b35.png b/test/fixtures/stylesheets/compass/images/flag-s03c3b29b35.png similarity index 100% rename from test/fixtures/stylesheets/compass/images/flag-03c3b29b35.png rename to test/fixtures/stylesheets/compass/images/flag-s03c3b29b35.png diff --git a/test/integrations/sprites_test.rb b/test/integrations/sprites_test.rb index 23a45996..126ad8c3 100644 --- a/test/integrations/sprites_test.rb +++ b/test/integrations/sprites_test.rb @@ -59,7 +59,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -70,8 +70,8 @@ class SpritesTest < Test::Unit::TestCase background-position: 0 -10px; } CSS - assert_equal image_size('squares-*.png'), [20, 30] - assert_equal image_md5('squares-*.png'), 'fcc93d7b279c2ad6898fbca49cbd01e1' + assert_equal image_size('squares-s*.png'), [20, 30] + assert_equal image_md5('squares-s*.png'), 'fcc93d7b279c2ad6898fbca49cbd01e1' end it "should generate sprite classes with dimensions" do @@ -82,7 +82,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -97,7 +97,7 @@ class SpritesTest < Test::Unit::TestCase width: 20px; } CSS - assert_equal image_size('squares-*.png'), [20, 30] + assert_equal image_size('squares-s*.png'), [20, 30] end it "should provide sprite mixin" do @@ -114,7 +114,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .squares-sprite, .cubicle, .large-cube { - background: url('/squares-161c60ad78.png') no-repeat; + background: url('/squares-s161c60ad78.png') no-repeat; } .cubicle { @@ -127,7 +127,7 @@ class SpritesTest < Test::Unit::TestCase width: 20px; } CSS - assert_equal image_size('squares-*.png'), [20, 30] + assert_equal image_size('squares-s*.png'), [20, 30] end # CUSTOMIZATIONS: @@ -139,10 +139,10 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .circles { - background: url('/squares-161c60ad78.png') no-repeat; + background: url('/squares-s161c60ad78.png') no-repeat; } CSS - assert_equal image_size('squares-*.png'), [20, 30] + assert_equal image_size('squares-s*.png'), [20, 30] end it "should calculate the spacing between images but not before first image" do @@ -153,7 +153,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -164,7 +164,7 @@ class SpritesTest < Test::Unit::TestCase background-position: 0 -43px; } CSS - assert_equal image_size('squares-*.png'), [20, 63] + assert_equal image_size('squares-s*.png'), [20, 63] end it "should calculate the spacing between images" do @@ -175,7 +175,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -186,7 +186,7 @@ class SpritesTest < Test::Unit::TestCase background-position: 0 -43px; } CSS - assert_equal image_size('squares-*.png'), [20, 63] + assert_equal image_size('squares-s*.png'), [20, 63] end it "should calculate the maximum spacing between images" do @@ -198,7 +198,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -209,7 +209,7 @@ class SpritesTest < Test::Unit::TestCase background-position: 0 -54px; } CSS - assert_equal image_size('squares-*.png'), [20, 74] + assert_equal image_size('squares-s*.png'), [20, 74] end it "should calculate the maximum spacing between images in reversed order" do @@ -221,7 +221,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -232,7 +232,7 @@ class SpritesTest < Test::Unit::TestCase background-position: 0 -54px; } CSS - assert_equal image_size('squares-*.png'), [20, 74] + assert_equal image_size('squares-s*.png'), [20, 74] end it "should calculate the default spacing between images" do @@ -243,7 +243,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -254,7 +254,7 @@ class SpritesTest < Test::Unit::TestCase background-position: 0 -32px; } CSS - assert_equal image_size('squares-*.png'), [20, 52] + assert_equal image_size('squares-s*.png'), [20, 52] end it "should use position adjustments in functions" do @@ -278,7 +278,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .squares-sprite { - background: url('/squares-8e490168dd.png') no-repeat; + background: url('/squares-s8e490168dd.png') no-repeat; } .adjusted-percentage { @@ -293,8 +293,8 @@ class SpritesTest < Test::Unit::TestCase background-position: -3px -8px; } CSS - assert_equal image_size('squares-*.png'), [20, 30] - assert_equal image_md5('squares-*.png'), '652b67f5e9092520d6f26caae7e18012' + assert_equal image_size('squares-s*.png'), [20, 30] + assert_equal image_md5('squares-s*.png'), '652b67f5e9092520d6f26caae7e18012' end it "should use position adjustments in mixins" do @@ -316,7 +316,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -331,8 +331,8 @@ class SpritesTest < Test::Unit::TestCase background-position: -3px -8px; } CSS - assert_equal image_size('squares-*.png'), [20, 30] - assert_equal image_md5('squares-*.png'), '652b67f5e9092520d6f26caae7e18012' + assert_equal image_size('squares-s*.png'), [20, 30] + assert_equal image_md5('squares-s*.png'), '652b67f5e9092520d6f26caae7e18012' end it "should repeat the image" do @@ -343,7 +343,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .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 { @@ -354,8 +354,8 @@ class SpritesTest < Test::Unit::TestCase background-position: 0 -10px; } CSS - assert_equal image_size('squares-*.png'), [20, 30] - assert_equal image_md5('squares-*.png'), '94abae8440f1b58617f52920b70aaed2' + assert_equal image_size('squares-s*.png'), [20, 30] + assert_equal image_md5('squares-s*.png'), '94abae8440f1b58617f52920b70aaed2' end 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 assert_correct css, <<-CSS .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 { @@ -378,8 +378,8 @@ class SpritesTest < Test::Unit::TestCase background-position: -10px -10px; } CSS - assert_equal image_size('squares-*.png'), [30, 30] - assert_equal image_md5('squares-*.png'), '2fb19ef9c83018c93c6f147af3a56cb2' + assert_equal image_size('squares-s*.png'), [30, 30] + assert_equal image_md5('squares-s*.png'), '2fb19ef9c83018c93c6f147af3a56cb2' end it "should provide a nice errors for lemonade's old users" do @@ -416,7 +416,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .squares { - background: url('/squares-145869726f.png') 0 -10px no-repeat; + background: url('/squares-s145869726f.png') 0 -10px no-repeat; } CSS end @@ -432,10 +432,10 @@ class SpritesTest < Test::Unit::TestCase @include sprite-background-position($squares-sprites, "ten-by-ten"); } SCSS - assert_equal image_size('squares-*.png'), [20, 40] + assert_equal image_size('squares-s*.png'), [20, 40] assert_correct css, <<-CSS .squares-sprite { - background: url('/squares-e3c68372d9.png') no-repeat; + background: url('/squares-se3c68372d9.png') no-repeat; } .foo { @@ -455,7 +455,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .selectors-sprite, .selectors-ten-by-ten { - background: url('/selectors-edfef809e2.png') no-repeat; + background: url('/selectors-sedfef809e2.png') no-repeat; } .selectors-ten-by-ten { @@ -482,7 +482,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .selectors-sprite, a { - background: url('/selectors-edfef809e2.png') no-repeat; + background: url('/selectors-sedfef809e2.png') no-repeat; } a { @@ -510,7 +510,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .selectors-sprite, a { - background: url('/selectors-edfef809e2.png') no-repeat; + background: url('/selectors-sedfef809e2.png') no-repeat; } a { @@ -538,7 +538,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .ko-sprite, .ko-default_background, .ko-starbg26x27 { - background: url('/ko-cc3f80660d.png') no-repeat; + background: url('/ko-scc3f80660d.png') no-repeat; } .ko-default_background { @@ -552,8 +552,8 @@ class SpritesTest < Test::Unit::TestCase end it "should generate a sprite and remove the old file" do - FileUtils.touch File.join(@images_tmp_path, "selectors-cc8834Fdd.png") - assert_equal 1, map_files('selectors-*.png').size + FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Fdd.png") + assert_equal 1, map_files('selectors-s*.png').size css = render <<-SCSS @import "selectors/*.png"; a { @@ -561,12 +561,12 @@ class SpritesTest < Test::Unit::TestCase @include selectors-sprite(ten-by-ten) } 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 it "should generate a sprite and NOT remove the old file" do - FileUtils.touch File.join(@images_tmp_path, "selectors-cc8834Ftest.png") - assert_equal 1, map_files('selectors-*.png').size + FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Ftest.png") + assert_equal 1, map_files('selectors-s*.png').size css = render <<-SCSS $selectors-clean-up: false; @import "selectors/*.png"; @@ -575,7 +575,7 @@ class SpritesTest < Test::Unit::TestCase @include selectors-sprite(ten-by-ten) } 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 it "should generate a sprite if the sprite is a colorname" do @@ -595,7 +595,7 @@ class SpritesTest < Test::Unit::TestCase SCSS assert_correct css, <<-CSS .nested-sprite, .nested-ten-by-ten { - background: url('/nested-55a8935544.png') no-repeat; + background: url('/nested-s55a8935544.png') no-repeat; } .nested-ten-by-ten { diff --git a/test/units/sprites/sprite_map_test.rb b/test/units/sprites/sprite_map_test.rb index 0587657f..56f10885 100644 --- a/test/units/sprites/sprite_map_test.rb +++ b/test/units/sprites/sprite_map_test.rb @@ -49,7 +49,7 @@ class SpriteMapTest < Test::Unit::TestCase end 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 it "should return the 'ten-by-ten' image" do