compass 1.1.0.alpha.0 → 1.1.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/compass/configuration/helpers.rb +4 -4
- data/lib/compass/generated_version.rb +1 -1
- data/lib/compass/sass_extensions/functions/sprites.rb +1 -3
- data/lib/compass/sass_extensions/sprites/image.rb +1 -6
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +1 -8
- data/lib/compass/sprite_importer.rb +24 -22
- data/lib/compass.rb +1 -0
- data/test/units/sprites/sprite_map_test.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c34f4a9522411d067ced24bf4e65aacd01b161b0
|
4
|
+
data.tar.gz: 9062ad628caa3eca0c7625a4c024a567cb65ca9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aae0a4826987f8add3ba159a8d7d4f7243e180904c1e848f75b34d0b8f22481d61186c29bb23529b05568ce4f88de9173162925cfa995af75b0b851bb1f6534
|
7
|
+
data.tar.gz: b6eb04af255592ee36ead5c97df32a142ee03908985c088caceb6bb4fe83c85554d8d950c82c017b465fd6fa33cc217293e2154def054df42d106a19cefdc71e
|
@@ -47,11 +47,11 @@ module Compass
|
|
47
47
|
else
|
48
48
|
Sass::Plugin.on_updating_stylesheet(&on_saved)
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
Sass::Plugin.on_compilation_error do |e, filename, css|
|
52
52
|
Compass.configuration.run_stylesheet_error(filename, e.message)
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
@callbacks_loaded = true
|
56
56
|
end
|
57
57
|
end
|
@@ -66,7 +66,7 @@ module Compass
|
|
66
66
|
configuration_file_path = args.shift || detect_configuration_file
|
67
67
|
|
68
68
|
raise ArgumentError, "Too many arguments" if args.any?
|
69
|
-
if
|
69
|
+
if data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
|
70
70
|
if data.raw_project_type
|
71
71
|
add_configuration(data.raw_project_type.to_sym)
|
72
72
|
elsif options[:project_type]
|
@@ -75,7 +75,7 @@ module Compass
|
|
75
75
|
add_configuration(:stand_alone)
|
76
76
|
end
|
77
77
|
add_configuration(data)
|
78
|
-
|
78
|
+
elsif !AppIntegration.default?
|
79
79
|
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
|
80
80
|
end
|
81
81
|
end
|
@@ -120,9 +120,7 @@ module Compass::SassExtensions::Functions::Sprites
|
|
120
120
|
verify_map(map, "sprite")
|
121
121
|
verify_sprite(sprite)
|
122
122
|
if image = map.image_for(sprite.value)
|
123
|
-
|
124
|
-
images_path = Pathname.new(File.expand_path(Compass.configuration.images_path))
|
125
|
-
quoted_string(image_path.relative_path_from(images_path).to_s)
|
123
|
+
quoted_string(Compass.configuration.sprite_resolver.relative_path(:image, image.file))
|
126
124
|
else
|
127
125
|
missing_image!(map, sprite)
|
128
126
|
end
|
@@ -30,12 +30,7 @@ module Compass
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def find_file
|
33
|
-
Compass.configuration.
|
34
|
-
f = File.join(path, relative_file)
|
35
|
-
if File.exists?(f)
|
36
|
-
return f
|
37
|
-
end
|
38
|
-
end
|
33
|
+
Compass.configuration.sprite_resolver.find_asset(:image, relative_file)
|
39
34
|
end
|
40
35
|
|
41
36
|
# Width of the image
|
@@ -24,14 +24,7 @@ module Compass
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.relative_name(sprite)
|
27
|
-
|
28
|
-
Compass.configuration.sprite_load_path.each do |path|
|
29
|
-
path_with_slash = "#{File.expand_path(path)}/"
|
30
|
-
|
31
|
-
if sprite.include?(path_with_slash)
|
32
|
-
return sprite.gsub(path_with_slash, '')
|
33
|
-
end
|
34
|
-
end
|
27
|
+
Compass.configuration.sprite_resolver.relative_path(:image, sprite)
|
35
28
|
end
|
36
29
|
|
37
30
|
def initialize(sprites, path, name, context, kwargs)
|
@@ -5,35 +5,33 @@ module Compass
|
|
5
5
|
VAILD_FILE_NAME = /\A#{Sass::SCSS::RX::IDENT}\Z/
|
6
6
|
SPRITE_IMPORTER_REGEX = %r{((.+/)?([^\*.]+))/(.+?)\.png}
|
7
7
|
VALID_EXTENSIONS = ['.png']
|
8
|
-
|
8
|
+
|
9
9
|
TEMPLATE_FOLDER = File.join(File.expand_path('../', __FILE__), 'sprite_importer')
|
10
10
|
CONTENT_TEMPLATE_FILE = File.join(TEMPLATE_FOLDER, 'content.erb')
|
11
11
|
CONTENT_TEMPLATE = ERB.new(File.read(CONTENT_TEMPLATE_FILE))
|
12
12
|
|
13
|
-
|
14
|
-
|
15
13
|
# finds all sprite files
|
16
14
|
def self.find_all_sprite_map_files(path)
|
17
15
|
hex = "[0-9a-f]"
|
18
16
|
glob = "*-s#{hex*10}{#{VALID_EXTENSIONS.join(",")}}"
|
19
17
|
Sass::Util.glob(File.join(path, "**", glob))
|
20
18
|
end
|
21
|
-
|
19
|
+
|
22
20
|
def find(uri, options)
|
23
21
|
if uri =~ SPRITE_IMPORTER_REGEX
|
24
22
|
return self.class.sass_engine(uri, self.class.sprite_name(uri), self, options)
|
25
23
|
end
|
26
24
|
nil
|
27
25
|
end
|
28
|
-
|
26
|
+
|
29
27
|
def find_relative(uri, base, options)
|
30
28
|
nil
|
31
29
|
end
|
32
|
-
|
30
|
+
|
33
31
|
def to_s
|
34
32
|
self.class.name
|
35
33
|
end
|
36
|
-
|
34
|
+
|
37
35
|
def hash
|
38
36
|
self.class.name.hash
|
39
37
|
end
|
@@ -41,13 +39,13 @@ module Compass
|
|
41
39
|
def eql?(other)
|
42
40
|
other.class == self.class
|
43
41
|
end
|
44
|
-
|
42
|
+
|
45
43
|
def mtime(uri, options)
|
46
44
|
self.class.files(uri).sort.inject(Time.at(0)) do |max_time, file|
|
47
45
|
(t = File.mtime(file)) > max_time ? t : max_time
|
48
46
|
end
|
49
47
|
end
|
50
|
-
|
48
|
+
|
51
49
|
def key(uri, options={})
|
52
50
|
[self.class.name + ":sprite:" + File.dirname(File.expand_path(uri)), File.basename(uri)]
|
53
51
|
end
|
@@ -56,8 +54,7 @@ module Compass
|
|
56
54
|
nil
|
57
55
|
end
|
58
56
|
|
59
|
-
|
60
|
-
def self.path_and_name(uri)
|
57
|
+
def self.path_and_name(uri)
|
61
58
|
if uri =~ SPRITE_IMPORTER_REGEX
|
62
59
|
[$1, $3]
|
63
60
|
else
|
@@ -76,17 +73,22 @@ module Compass
|
|
76
73
|
path, _ = path_and_name(uri)
|
77
74
|
path
|
78
75
|
end
|
79
|
-
|
76
|
+
|
80
77
|
# Returns the Glob of image files for the uri
|
81
78
|
def self.files(uri)
|
82
|
-
Compass.configuration.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
79
|
+
resolved_files = Compass.configuration.sprite_resolver.glob(:image, uri, :match_all => true)
|
80
|
+
resolved_files = resolved_files.inject({}) do |basenames, file|
|
81
|
+
basename = File.basename(file, '.png')
|
82
|
+
unless basenames.has_key?(basename)
|
83
|
+
basenames[basename] = true
|
84
|
+
basenames[:files] ||= []
|
85
|
+
basenames[:files] << file
|
86
|
+
end
|
87
|
+
basenames
|
88
|
+
end[:files]
|
89
|
+
return resolved_files.sort if resolved_files.any?
|
90
|
+
path = Compass.configuration.sprite_resolver.asset_collections.map{|ac| ac.images_path }.join(", ")
|
91
|
+
raise Compass::SpriteException, %Q{No images were found in the sprite path matching "#{uri}". Your current load paths are: #{path}}
|
90
92
|
end
|
91
93
|
|
92
94
|
# Returns an Array of image names without the file extension
|
@@ -95,12 +97,12 @@ module Compass
|
|
95
97
|
File.basename(file, '.png')
|
96
98
|
end
|
97
99
|
end
|
98
|
-
|
100
|
+
|
99
101
|
# Returns the sass_options for this sprite
|
100
102
|
def self.sass_options(uri, importer, options)
|
101
103
|
options.merge!(:filename => uri.gsub(%r{\*/},"*\\/"), :syntax => :scss, :importer => importer)
|
102
104
|
end
|
103
|
-
|
105
|
+
|
104
106
|
# Returns a Sass::Engine for this sprite object
|
105
107
|
def self.sass_engine(uri, name, importer, options)
|
106
108
|
content = content_for_images(uri, name, options[:skip_overrides])
|
data/lib/compass.rb
CHANGED
@@ -162,7 +162,7 @@ class SpriteMapTest < Test::Unit::TestCase
|
|
162
162
|
config.sprite_load_path = [@images_tmp_path, other_folder]
|
163
163
|
Compass.add_configuration(config, "sprite_config")
|
164
164
|
image = Compass::SassExtensions::Sprites::Image.new(@base, "foo/my.png", {})
|
165
|
-
assert_equal File.join(other_folder, 'foo/my.png'), image.file
|
165
|
+
assert_equal File.expand_path(File.join(other_folder, 'foo/my.png')), image.file
|
166
166
|
assert_equal 0, image.size
|
167
167
|
end
|
168
168
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.alpha.
|
4
|
+
version: 1.1.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Eppstein
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-
|
15
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: sass
|
@@ -40,14 +40,14 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.1.0.alpha.
|
43
|
+
version: 1.1.0.alpha.2
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - ~>
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 1.1.0.alpha.
|
50
|
+
version: 1.1.0.alpha.2
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
name: compass-import-once
|
53
53
|
requirement: !ruby/object:Gem::Requirement
|