Skip to content

New layout for sprites, heavily "packed" #1433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
e41a6af
New layout for sprites, heavily "packed"
kiafaldorius Oct 31, 2013
68a1f2b
add height and width _with_spacing helpers for Sprites::Image
kiafaldorius Dec 9, 2013
9f5f9d8
add sprite spacing to packed layout
kiafaldorius Dec 9, 2013
3ffd7b9
Add spacing to smart sprite layout
kiafaldorius Dec 9, 2013
c6138f4
update test for packed layout to accomodate spacing
kiafaldorius Dec 9, 2013
068a52b
Utility method to assert valid keys.
chriseppstein Aug 20, 2014
5fea13d
Add basic asset collection configuration via ruby and use it for imag…
chriseppstein Aug 24, 2014
d3ad03b
Use asset collections and asset resolver for fonts.
chriseppstein Aug 24, 2014
d39aa56
Use the asset resolver for generated images.
chriseppstein Aug 24, 2014
821db8a
Refactor stylesheet_url with better tools and remove useless code.
chriseppstein Aug 24, 2014
9ecba96
Allow sass-based configuration of asset collections.
chriseppstein Aug 25, 2014
2ee03e8
Put sass files from an asset collection on the load path.
chriseppstein Aug 25, 2014
6aea71e
CHANGELOG entry for asset collections.
chriseppstein Aug 26, 2014
0d23320
Document asset collections.
chriseppstein Aug 26, 2014
63ece54
Start 1.1 development.
chriseppstein Aug 26, 2014
8ab4e15
update deploy script
chriseppstein Aug 26, 2014
2807a16
update gemfile
chriseppstein Aug 26, 2014
b2b1d07
Make sprites use asset collections. Allow multiple sprite locations t…
chriseppstein Sep 4, 2014
ffc89c6
Bump version to 1.1.0.alpha.1.
chriseppstein Sep 4, 2014
4a1b1c1
Bump version to 1.1.0.alpha.1.
chriseppstein Sep 4, 2014
7214b4c
Stable output for this test case.
chriseppstein Sep 4, 2014
9f2cf09
Merge branch 'stable'
chriseppstein Sep 4, 2014
2c1907d
See if this fixes travis tests.
chriseppstein Sep 4, 2014
afa32db
Add missing require.
chriseppstein Sep 10, 2014
7d41ee5
Adding an application integration caused the config file to stop bein…
chriseppstein Sep 10, 2014
f749d49
Bump version to 1.1.0.alpha.2.
chriseppstein Sep 10, 2014
e8eed50
Bump version to 1.1.0.alpha.2.
chriseppstein Sep 10, 2014
0f516e6
Make gradients work with Sass's inspect().
chriseppstein Sep 17, 2014
113a57f
Fix how asset collections are added so that they use the array proxy …
chriseppstein Sep 17, 2014
35c60cb
Make gradients work with Sass's inspect().
chriseppstein Sep 17, 2014
cfcb45b
Bump version to 1.1.0.alpha.3.
chriseppstein Sep 17, 2014
cb4e2a4
Bump version to 1.1.0.alpha.3.
chriseppstein Sep 17, 2014
5d99531
moved valid extensions down to the engine level so engines can be bui…
scottdavis Jun 5, 2013
6923cbe
updated documentation
scottdavis Jun 5, 2013
4ea9751
added sprites folder
scottdavis Dec 15, 2013
c5631f9
updated core git ignore
scottdavis Dec 27, 2013
deaaa14
created sprites gemspec
scottdavis Dec 27, 2013
1682d42
move over sprite tests
scottdavis Dec 31, 2013
c6353cc
WIP refactoring tests to use def test
scottdavis Dec 31, 2013
17dbae7
convert to test unit format
scottdavis Jan 2, 2014
04800e0
WIP tests
scottdavis Jan 7, 2014
616826f
move test helpers
scottdavis Jan 7, 2014
0733974
move test helpers WIP
scottdavis Jan 7, 2014
8caef49
WIP
scottdavis Jan 9, 2014
b0ca99c
moved regression test and speed up call back test by ~4seconds
scottdavis Jan 9, 2014
fed17e4
upgraded mocha
scottdavis Jan 9, 2014
2d99473
finished decomposing test helpers
scottdavis Jan 9, 2014
6d5a1fe
added diff
scottdavis Jan 9, 2014
655671e
finished test helper decompose
scottdavis Jan 9, 2014
fb51b38
update tests to incude the correct modules
scottdavis Jan 9, 2014
2ea82b8
prep for moving over actual sprite code
scottdavis Jan 9, 2014
c29ad77
test pass importer moved over
scottdavis Jan 18, 2014
81e32f9
test pass importer moved over
scottdavis Jan 18, 2014
60638f5
sprite tests are green
scottdavis Feb 23, 2014
86f870e
all tests pass
scottdavis Feb 23, 2014
baa435e
meta info
scottdavis Aug 3, 2014
967c189
fix cruft from rebase
scottdavis Sep 5, 2014
5098558
sprite tests pass
scottdavis Sep 5, 2014
caefe43
sass bump
scottdavis Sep 5, 2014
18fed8c
tests all pass!
scottdavis Sep 5, 2014
8961782
cli tests need sprites gem on ci
scottdavis Sep 5, 2014
ef9e3e5
updated sass
scottdavis Sep 21, 2014
5fedb5b
remove un needed module load
scottdavis Sep 24, 2014
f14211b
remove unneeded comment
scottdavis Sep 24, 2014
6123d4e
remove needed sprite importer object
scottdavis Sep 24, 2014
87880a1
gemspec issue with chucky png
scottdavis Sep 24, 2014
7e82065
Merge remote-tracking branch 'kia/packing-sprites' into decompose_spr…
kiafaldorius Sep 29, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Guardfile

This file was deleted.

2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

GEMS = ['core', 'cli', 'import-once']
GEMS = ['core', 'cli', 'import-once', 'sprites']


task :default => %w[test]
Expand Down
3 changes: 2 additions & 1 deletion cli/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ unless ENV['PKG']
gem "compass-core", :path => "../core" unless defined?(CI)
gem "compass-import-once", :path => "../import-once" unless defined?(CI)
gem 'sass-globbing', "~> 1.1.1"
gem "compass-sprites", :path => "../sprites"
gem "cucumber", "~> 1.2.1"
gem "rspec", "~> 2.0.0"
gem "compass-validator", "3.0.1"
gem "css_parser", "~> 1.0.1"
gem "rubyzip", "0.9.9"
gem 'mocha', '0.11.4'
gem 'minitest', '2.12.1'
gem "mocha", "~> 0.14.0", :require => false
gem 'diff-lcs', '~> 1.1.2'
gem 'rake'
gem 'json', '~> 1.7.7', :platforms => :ruby_18
Expand Down
2 changes: 1 addition & 1 deletion cli/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.1.0.alpha.3
1 change: 0 additions & 1 deletion cli/compass.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Gem::Specification.new do |gemspec|
gemspec.add_dependency 'sass', '>= 3.3.13', '< 3.5'
gemspec.add_dependency 'compass-core', "~> #{File.read(File.join(File.dirname(__FILE__),"..","core","VERSION")).strip}"
gemspec.add_dependency 'compass-import-once', "~> #{File.read(File.join(File.dirname(__FILE__),"..","import-once","VERSION")).strip}"
gemspec.add_dependency 'chunky_png', '~> 1.2'
gemspec.add_dependency 'rb-fsevent', '>= 0.9.3'
gemspec.add_dependency 'rb-inotify', '>= 0.9'

Expand Down
6 changes: 3 additions & 3 deletions cli/features/step_definitions/command_line_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
require 'test_helper'

require 'compass/exec'
include Compass::TestCaseHelper
include Compass::CommandLineHelper
include Compass::IoHelper
include Compass::Test::TestCaseHelper
include Compass::Test::CommandLineHelper
include Compass::Test::IoHelper

Before do
Compass.reset_configuration!
Expand Down
3 changes: 2 additions & 1 deletion cli/lib/compass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def lib_directory
configuration/file_data
app_integration
compiler
sprite_importer
sass_compiler
).each do |lib|
require "compass/#{lib}"
end
require 'compass/sprites/importer'
5 changes: 2 additions & 3 deletions cli/lib/compass/commands/sprite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ def initialize(working_path, options)

def perform
relative_uri = options[:uri].gsub(/^#{Compass.configuration.images_dir}\//, '')
name = Compass::SpriteImporter.sprite_name(relative_uri)
sprites = Compass::SpriteImporter.new
name = Compass::Sprites::Importer.sprite_name(relative_uri)
options[:output_file] ||= File.join(Compass.configuration.sass_path, "sprites", "_#{name}.#{Compass.configuration.preferred_syntax}")
options[:skip_overrides] ||= false
contents = Compass::SpriteImporter.content_for_images(relative_uri, name, options[:skip_overrides])
contents = Compass::Sprites::Importer.content_for_images(relative_uri, name, options[:skip_overrides])
if options[:output_file][-4..-1] != "scss"
contents = Sass::Engine.new(contents, Compass.sass_engine_options.merge(:syntax => :scss)).to_tree.to_sass
end
Expand Down
8 changes: 4 additions & 4 deletions cli/lib/compass/configuration/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def configure_sass_plugin!
else
Sass::Plugin.on_updating_stylesheet(&on_saved)
end

Sass::Plugin.on_compilation_error do |e, filename, css|
Compass.configuration.run_stylesheet_error(filename, e.message)
end

@callbacks_loaded = true
end
end
Expand All @@ -66,7 +66,7 @@ def add_project_configuration(*args)
configuration_file_path = args.shift || detect_configuration_file

raise ArgumentError, "Too many arguments" if args.any?
if AppIntegration.default? && data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
if data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
if data.raw_project_type
add_configuration(data.raw_project_type.to_sym)
elsif options[:project_type]
Expand All @@ -75,7 +75,7 @@ def add_project_configuration(*args)
add_configuration(:stand_alone)
end
add_configuration(data)
else
elsif !AppIntegration.default?
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
end
end
Expand Down
4 changes: 0 additions & 4 deletions cli/lib/compass/sass_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@
raise LoadError, "It looks like you've got an incompatible version of Sass. This often happens when you have an old haml gem installed. Please upgrade Haml to v3.1 or above."
end

module Compass::SassExtensions
end

require 'compass/sass_extensions/functions'
require 'compass/sass_extensions/sprites'
8 changes: 0 additions & 8 deletions cli/lib/compass/sass_extensions/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ def declare(*args)
end
end
end

%w(sprites).each do |func|
require "compass/sass_extensions/functions/#{func}"
end

module Sass::Script::Functions
include Compass::SassExtensions::Functions::Sprites
end
21 changes: 0 additions & 21 deletions cli/lib/compass/sass_extensions/sprites.rb

This file was deleted.

117 changes: 0 additions & 117 deletions cli/lib/compass/sprite_importer.rb

This file was deleted.

4 changes: 2 additions & 2 deletions cli/test/fixtures/stylesheets/busted_font_urls/css/screen.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.showgrid { font-family: url('http://assets3.example.com/fonts/grid-BUSTED.ttf'); }
.showgrid { font-family: url('http://assets2.example.com/fonts/grid-BUSTED.ttf'); }

.no-buster { font-family: url('http://assets3.example.com/fonts/grid.ttf'); }

.buster-by-default { font-family: url('http://assets3.example.com/fonts/grid-BUSTED.ttf'); }
.buster-by-default { font-family: url('http://assets2.example.com/fonts/grid-BUSTED.ttf'); }

.feed { font-family: url('http://assets3.example.com/fonts/feed.ttf?query_string'); }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.showgrid { background-image: url('http://assets0.example.com/images/grid-BUSTED.png'); }
.showgrid { background-image: url('http://assets3.example.com/images/grid-BUSTED.png'); }

.inlinegrid { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAUEAYAAACv1qP4AAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAZ0lEQVRYw+3QwQ2AIBAFUTEUwI3+uzN7gDscsIgxEuO8An52J11X73OudfxMraXkzHfO3Y98nQEhA0IGhAwIGRAyIGRAyICQASEDQgaEDAgZEDIgZEDIgJABoZzSGK3tPuN9ERFP7Nw4fg+c5g8V1wAAAABJRU5ErkJggg=='); }

Expand Down
1 change: 1 addition & 0 deletions cli/test/fixtures/stylesheets/compass/config.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Require any additional compass plugins here.
require 'true'
require 'compass/import-once/activate'
require 'compass/sprites'
project_type = :stand_alone
css_dir = "tmp"
sass_dir = "sass"
Expand Down
2 changes: 1 addition & 1 deletion cli/test/fixtures/stylesheets/compass/css/images.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
background-image: url('/images/4x6.png?busted=true'); }

.absolute {
background-image: url(http://example.com/images/4x6.png); }
background-image: url('http://example.com/images/4x6.png'); }
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions cli/test/fixtures/stylesheets/image_urls/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@
asset_host do |path|
"http://assets%d.example.com" % (path.size % 4)
end

add_asset_collection(
:root_dir => "other/asset_collection",
:http_dir => "ext-assets",
:images_dir => "img",
:sass_dir => "scss"
)
2 changes: 2 additions & 0 deletions cli/test/fixtures/stylesheets/image_urls/css/screen.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.imported-from-asset-collection { color: red; }

.showgrid { background-image: url('http://assets0.example.com/images/grid.png?busted=true'); }

.inlinegrid { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAUEAYAAACv1qP4AAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAZ0lEQVRYw+3QwQ2AIBAFUTEUwI3+uzN7gDscsIgxEuO8An52J11X73OudfxMraXkzHfO3Y98nQEhA0IGhAwIGRAyIGRAyICQASEDQgaEDAgZEDIgZEDIgJABoZzSGK3tPuN9ERFP7Nw4fg+c5g8V1wAAAABJRU5ErkJggg=='); }
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.imported-from-asset-collection { color: red; }
2 changes: 2 additions & 0 deletions cli/test/fixtures/stylesheets/image_urls/sass/screen.sass
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "ac-stylesheet"

.showgrid
background-image: image-url(unquote("grid.png"))

Expand Down
Loading