sprockets-sass 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +60 -8
- data/README.md +8 -0
- data/gemfiles/{compass-0.11.gemfile → compass-0.11_sass-3.1.gemfile} +1 -0
- data/gemfiles/compass-0.11_sass-3.2.gemfile +8 -0
- data/gemfiles/{sprockets-2.0.gemfile → sprockets-2.0_sass-3.1.gemfile} +1 -0
- data/gemfiles/sprockets-2.0_sass-3.2.gemfile +8 -0
- data/gemfiles/{sprockets-2.1.gemfile → sprockets-2.1_sass-3.1.gemfile} +1 -0
- data/gemfiles/sprockets-2.1_sass-3.2.gemfile +8 -0
- data/gemfiles/{sprockets-2.2.gemfile → sprockets-2.2_sass-3.1.gemfile} +1 -0
- data/gemfiles/sprockets-2.2_sass-3.2.gemfile +8 -0
- data/gemfiles/{sprockets-2.3.gemfile → sprockets-2.3_sass-3.1.gemfile} +1 -0
- data/gemfiles/sprockets-2.3_sass-3.2.gemfile +8 -0
- data/gemfiles/{sprockets-2.4.gemfile → sprockets-2.4_sass-3.1.gemfile} +1 -0
- data/gemfiles/sprockets-2.4_sass-3.2.gemfile +8 -0
- data/gemfiles/sprockets-2.5_sass-3.1.gemfile +8 -0
- data/gemfiles/sprockets-2.5_sass-3.2.gemfile +8 -0
- data/gemfiles/sprockets-2.6_sass-3.1.gemfile +8 -0
- data/gemfiles/sprockets-2.6_sass-3.2.gemfile +8 -0
- data/lib/sprockets/sass.rb +1 -0
- data/lib/sprockets/sass/functions.rb +13 -13
- data/lib/sprockets/sass/sass_template.rb +15 -14
- data/lib/sprockets/sass/version.rb +1 -1
- data/spec/sprockets-sass_spec.rb +56 -49
- data/sprockets-sass.gemspec +2 -2
- metadata +85 -31
- data/gemfiles/compass-0.12.gemfile +0 -7
data/Appraisals
CHANGED
@@ -1,27 +1,79 @@
|
|
1
|
-
appraise 'sprockets-2.
|
1
|
+
appraise 'sprockets-2.0_sass-3.1' do
|
2
2
|
gem 'sprockets', '~> 2.0.0'
|
3
|
+
gem 'sass', '~> 3.1.0'
|
3
4
|
end
|
4
5
|
|
5
|
-
appraise 'sprockets-2.1' do
|
6
|
+
appraise 'sprockets-2.1_sass-3.1' do
|
6
7
|
gem 'sprockets', '~> 2.1.0'
|
8
|
+
gem 'sass', '~> 3.1.0'
|
7
9
|
end
|
8
10
|
|
9
|
-
appraise 'sprockets-2.
|
11
|
+
appraise 'sprockets-2.2_sass-3.1' do
|
10
12
|
gem 'sprockets', '~> 2.2.0'
|
13
|
+
gem 'sass', '~> 3.1.0'
|
11
14
|
end
|
12
15
|
|
13
|
-
appraise 'sprockets-2.3' do
|
16
|
+
appraise 'sprockets-2.3_sass-3.1' do
|
14
17
|
gem 'sprockets', '~> 2.3.0'
|
18
|
+
gem 'sass', '~> 3.1.0'
|
15
19
|
end
|
16
20
|
|
17
|
-
appraise 'sprockets-2.
|
21
|
+
appraise 'sprockets-2.4_sass-3.1' do
|
18
22
|
gem 'sprockets', '~> 2.4.0'
|
23
|
+
gem 'sass', '~> 3.1.0'
|
19
24
|
end
|
20
25
|
|
21
|
-
appraise '
|
26
|
+
appraise 'sprockets-2.5_sass-3.1' do
|
27
|
+
gem 'sprockets', '~> 2.5.0'
|
28
|
+
gem 'sass', '~> 3.1.0'
|
29
|
+
end
|
30
|
+
|
31
|
+
appraise 'sprockets-2.6_sass-3.1' do
|
32
|
+
gem 'sprockets', '~> 2.6.0'
|
33
|
+
gem 'sass', '~> 3.1.0'
|
34
|
+
end
|
35
|
+
|
36
|
+
appraise 'sprockets-2.0_sass-3.2' do
|
37
|
+
gem 'sprockets', '~> 2.0.0'
|
38
|
+
gem 'sass', '~> 3.2.0'
|
39
|
+
end
|
40
|
+
|
41
|
+
appraise 'sprockets-2.1_sass-3.2' do
|
42
|
+
gem 'sprockets', '~> 2.1.0'
|
43
|
+
gem 'sass', '~> 3.2.0'
|
44
|
+
end
|
45
|
+
|
46
|
+
appraise 'sprockets-2.2_sass-3.2' do
|
47
|
+
gem 'sprockets', '~> 2.2.0'
|
48
|
+
gem 'sass', '~> 3.2.0'
|
49
|
+
end
|
50
|
+
|
51
|
+
appraise 'sprockets-2.3_sass-3.2' do
|
52
|
+
gem 'sprockets', '~> 2.3.0'
|
53
|
+
gem 'sass', '~> 3.2.0'
|
54
|
+
end
|
55
|
+
|
56
|
+
appraise 'sprockets-2.4_sass-3.2' do
|
57
|
+
gem 'sprockets', '~> 2.4.0'
|
58
|
+
gem 'sass', '~> 3.2.0'
|
59
|
+
end
|
60
|
+
|
61
|
+
appraise 'sprockets-2.5_sass-3.2' do
|
62
|
+
gem 'sprockets', '~> 2.5.0'
|
63
|
+
gem 'sass', '~> 3.2.0'
|
64
|
+
end
|
65
|
+
|
66
|
+
appraise 'sprockets-2.6_sass-3.2' do
|
67
|
+
gem 'sprockets', '~> 2.6.0'
|
68
|
+
gem 'sass', '~> 3.2.0'
|
69
|
+
end
|
70
|
+
|
71
|
+
appraise 'compass-0.11_sass-3.1' do
|
22
72
|
gem 'compass', '~> 0.11.0'
|
73
|
+
gem 'sass', '~> 3.1.0'
|
23
74
|
end
|
24
75
|
|
25
|
-
appraise 'compass-0.
|
26
|
-
gem 'compass', '~> 0.
|
76
|
+
appraise 'compass-0.11_sass-3.2' do
|
77
|
+
gem 'compass', '~> 0.11.0'
|
78
|
+
gem 'sass', '~> 3.2.0'
|
27
79
|
end
|
data/README.md
CHANGED
@@ -90,6 +90,14 @@ button {
|
|
90
90
|
color: red; }
|
91
91
|
```
|
92
92
|
|
93
|
+
Passing Options to the Sass Engine
|
94
|
+
----------------------------------
|
95
|
+
|
96
|
+
If you would like to configure any of the Sass options, you can do so like this:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
Sprockets::Sass.options[:line_comments] = true
|
100
|
+
```
|
93
101
|
|
94
102
|
Compass Integration
|
95
103
|
-------------------
|
data/lib/sprockets/sass.rb
CHANGED
@@ -7,13 +7,13 @@ module Sprockets
|
|
7
7
|
# URI with the contents of the asset at the specified path.
|
8
8
|
#
|
9
9
|
# === Examples
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# background: asset-data-uri("image.jpg"); // background: url(data:image/jpeg;base64,...);
|
12
12
|
#
|
13
13
|
def asset_data_uri(source)
|
14
14
|
::Sass::Script::String.new "url(#{sprockets_context.asset_data_uri(source.value)})"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
# Using Sprockets::Helpers#asset_path, return the full path
|
18
18
|
# for the given +source+ as a Sass String. This supports keyword
|
19
19
|
# arguments that mirror the +options+.
|
@@ -29,14 +29,14 @@ module Sprockets
|
|
29
29
|
kind = options.value
|
30
30
|
options = {}
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
if kind && sprockets_context.respond_to?("#{kind}_path")
|
34
34
|
::Sass::Script::String.new sprockets_context.send("#{kind}_path", source.value), :string
|
35
35
|
else
|
36
36
|
::Sass::Script::String.new sprockets_context.asset_path(source.value, map_options(options)).to_s, :string
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
# Using Sprockets::Helpers#asset_path, return the url CSS
|
41
41
|
# for the given +source+ as a Sass String. This supports keyword
|
42
42
|
# arguments that mirror the +options+.
|
@@ -49,7 +49,7 @@ module Sprockets
|
|
49
49
|
def asset_url(source, options = {})
|
50
50
|
::Sass::Script::String.new "url(#{asset_path(source, options)})"
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
# Using Sprockets::Helpers#image_path, return the full path
|
54
54
|
# for the given +source+ as a Sass String. This supports keyword
|
55
55
|
# arguments that mirror the +options+.
|
@@ -62,7 +62,7 @@ module Sprockets
|
|
62
62
|
def image_path(source, options = {})
|
63
63
|
::Sass::Script::String.new sprockets_context.image_path(source.value, map_options(options)).to_s, :string
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
# Using Sprockets::Helpers#image_path, return the url CSS
|
67
67
|
# for the given +source+ as a Sass String. This supports keyword
|
68
68
|
# arguments that mirror the +options+.
|
@@ -97,7 +97,7 @@ module Sprockets
|
|
97
97
|
def font_path(source, options = {})
|
98
98
|
::Sass::Script::String.new sprockets_context.font_path(source.value, map_options(options)).to_s, :string
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
# Using Sprockets::Helpers#font_path, return the url CSS
|
102
102
|
# for the given +source+ as a Sass String. This supports keyword
|
103
103
|
# arguments that mirror the +options+.
|
@@ -119,15 +119,15 @@ module Sprockets
|
|
119
119
|
end
|
120
120
|
::Sass::Script::String.new "url(#{font_path(source, options)})"
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
protected
|
124
|
-
|
124
|
+
|
125
125
|
# Returns a reference to the Sprocket's context through
|
126
126
|
# the importer.
|
127
127
|
def sprockets_context # :nodoc:
|
128
|
-
options[:
|
128
|
+
options[:custom][:sprockets_context]
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
# Returns an options hash where the keys are symbolized
|
132
132
|
# and the values are unwrapped Sass literals.
|
133
133
|
def map_options(options = {}) # :nodoc:
|
@@ -141,13 +141,13 @@ end
|
|
141
141
|
|
142
142
|
module Sass::Script::Functions
|
143
143
|
include Sprockets::Sass::Functions
|
144
|
-
|
144
|
+
|
145
145
|
# Hack to ensure previous API declarations (by Compass or whatever)
|
146
146
|
# don't take precedence.
|
147
147
|
[:asset_path, :asset_url, :image_path, :image_url, :font_path, :font_url, :asset_data_uri].each do |method|
|
148
148
|
defined?(@signatures) && @signatures.delete(method)
|
149
149
|
end
|
150
|
-
|
150
|
+
|
151
151
|
declare :asset_path, [:source], :var_kwargs => true
|
152
152
|
declare :asset_path, [:source, :kind]
|
153
153
|
declare :asset_url, [:source], :var_kwargs => true
|
@@ -4,35 +4,35 @@ module Sprockets
|
|
4
4
|
module Sass
|
5
5
|
class SassTemplate < Tilt::SassTemplate
|
6
6
|
self.default_mime_type = 'text/css'
|
7
|
-
|
7
|
+
|
8
8
|
# A reference to the current Sprockets context
|
9
9
|
attr_reader :context
|
10
|
-
|
10
|
+
|
11
11
|
# Templates are initialized once the functions are added.
|
12
12
|
def self.engine_initialized?
|
13
13
|
super && (!Sass.add_sass_functions || defined?(Functions))
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
# Add the Sass functions if they haven't already been added.
|
17
17
|
def initialize_engine
|
18
18
|
super unless self.class.superclass.engine_initialized?
|
19
|
-
|
19
|
+
|
20
20
|
if Sass.add_sass_functions
|
21
21
|
require 'sprockets/sass/functions'
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# Define the expected syntax for the template
|
26
26
|
def syntax
|
27
27
|
:sass
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
# See `Tilt::Template#prepare`.
|
31
31
|
def prepare
|
32
32
|
@context = nil
|
33
33
|
@output = nil
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
# See `Tilt::Template#evaluate`.
|
37
37
|
def evaluate(context, locals, &block)
|
38
38
|
@output ||= begin
|
@@ -46,23 +46,23 @@ module Sprockets
|
|
46
46
|
end
|
47
47
|
|
48
48
|
protected
|
49
|
-
|
49
|
+
|
50
50
|
# Returns a Sprockets-aware cache store for Sass::Engine.
|
51
51
|
def cache_store
|
52
52
|
return nil if context.environment.cache.nil?
|
53
|
-
|
53
|
+
|
54
54
|
if defined?(Sprockets::SassCacheStore)
|
55
55
|
Sprockets::SassCacheStore.new context.environment
|
56
56
|
else
|
57
57
|
CacheStore.new context.environment
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
# A reference to the custom Sass importer, `Sprockets::Sass::Importer`.
|
62
62
|
def importer
|
63
63
|
Importer.new context
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
# Assemble the options for the `Sass::Engine`
|
67
67
|
def sass_options
|
68
68
|
merge_sass_options(default_sass_options, options).merge(
|
@@ -70,10 +70,11 @@ module Sprockets
|
|
70
70
|
:line => line,
|
71
71
|
:syntax => syntax,
|
72
72
|
:cache_store => cache_store,
|
73
|
-
:importer => importer
|
73
|
+
:importer => importer,
|
74
|
+
:custom => { :sprockets_context => context }
|
74
75
|
)
|
75
76
|
end
|
76
|
-
|
77
|
+
|
77
78
|
# Get the default, global Sass options. Start with Compass's
|
78
79
|
# options, if it's available.
|
79
80
|
def default_sass_options
|
@@ -83,7 +84,7 @@ module Sprockets
|
|
83
84
|
Sprockets::Sass.options.dup
|
84
85
|
end
|
85
86
|
end
|
86
|
-
|
87
|
+
|
87
88
|
# Merges two sets of `Sass::Engine` options, prepending
|
88
89
|
# the `:load_paths` instead of clobbering them.
|
89
90
|
def merge_sass_options(options, other_options)
|
data/spec/sprockets-sass_spec.rb
CHANGED
@@ -7,46 +7,46 @@ describe Sprockets::Sass do
|
|
7
7
|
@env = Sprockets::Environment.new @root.to_s
|
8
8
|
@env.append_path @assets.to_s
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
after :each do
|
12
12
|
@root.destroy!
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
it 'processes scss files normally' do
|
16
16
|
@assets.file 'main.css.scss', '//= require dep'
|
17
17
|
@assets.file 'dep.css.scss', 'body { color: blue; }'
|
18
18
|
asset = @env['main.css']
|
19
19
|
asset.to_s.should == "body {\n color: blue; }\n"
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
it 'processes sass files normally' do
|
23
23
|
@assets.file 'main.css.sass', '//= require dep'
|
24
24
|
@assets.file 'dep.css.sass', "body\n color: blue"
|
25
25
|
asset = @env['main.css']
|
26
26
|
asset.to_s.should == "body {\n color: blue; }\n"
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it 'imports standard files' do
|
30
30
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
31
31
|
@assets.file 'dep.css.scss', '$color: blue;'
|
32
32
|
asset = @env['main.css']
|
33
33
|
asset.to_s.should == "body {\n color: blue; }\n"
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
it 'imports partials' do
|
37
37
|
@assets.file 'main.css.scss', %(@import "_dep";\nbody { color: $color; })
|
38
38
|
@assets.file '_dep.css.scss', '$color: blue;'
|
39
39
|
asset = @env['main.css']
|
40
40
|
asset.to_s.should == "body {\n color: blue; }\n"
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
it 'imports other syntax' do
|
44
44
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
45
45
|
@assets.file 'dep.sass', "$color: blue\nhtml\n height: 100%"
|
46
46
|
asset = @env['main.css']
|
47
47
|
asset.to_s.should == "html {\n height: 100%; }\n\nbody {\n color: blue; }\n"
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it 'imports files with the correct content type' do
|
51
51
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
52
52
|
@assets.file 'dep.js', 'var app = {};'
|
@@ -54,7 +54,7 @@ describe Sprockets::Sass do
|
|
54
54
|
asset = @env['main.css']
|
55
55
|
asset.to_s.should == "body {\n color: blue; }\n"
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
it 'imports files with directives' do
|
59
59
|
@assets.file 'main.css.scss', %(@import "dep";)
|
60
60
|
@assets.file 'dep.css', "/*\n *= require subdep\n */"
|
@@ -62,14 +62,14 @@ describe Sprockets::Sass do
|
|
62
62
|
asset = @env['main.css']
|
63
63
|
asset.to_s.should include("body {\n color: blue; }\n")
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
it 'imports files with additional processors' do
|
67
67
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
68
68
|
@assets.file 'dep.css.scss.erb', "$color: <%= 'blue' %>;"
|
69
69
|
asset = @env['main.css']
|
70
70
|
asset.to_s.should == "body {\n color: blue; }\n"
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
it 'imports relative files' do
|
74
74
|
@assets.file 'folder/main.css.scss', %(@import "./dep-1";\n@import "./subfolder/dep-2";\nbody { background-color: $background-color; color: $color; })
|
75
75
|
@assets.file 'folder/dep-1.css.scss', '$background-color: red;'
|
@@ -77,7 +77,7 @@ describe Sprockets::Sass do
|
|
77
77
|
asset = @env['folder/main.css']
|
78
78
|
asset.to_s.should == "body {\n background-color: red;\n color: blue; }\n"
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
it 'imports relative partials' do
|
82
82
|
@assets.file 'folder/main.css.scss', %(@import "./dep-1";\n@import "./subfolder/dep-2";\nbody { background-color: $background-color; color: $color; })
|
83
83
|
@assets.file 'folder/_dep-1.css.scss', '$background-color: red;'
|
@@ -85,7 +85,7 @@ describe Sprockets::Sass do
|
|
85
85
|
asset = @env['folder/main.css']
|
86
86
|
asset.to_s.should == "body {\n background-color: red;\n color: blue; }\n"
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
it 'imports relative files without preceding ./' do
|
90
90
|
@assets.file 'folder/main.css.scss', %(@import "dep-1";\n@import "subfolder/dep-2";\nbody { background-color: $background-color; color: $color; })
|
91
91
|
@assets.file 'folder/dep-1.css.scss', '$background-color: red;'
|
@@ -93,7 +93,7 @@ describe Sprockets::Sass do
|
|
93
93
|
asset = @env['folder/main.css']
|
94
94
|
asset.to_s.should == "body {\n background-color: red;\n color: blue; }\n"
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
it 'imports relative partials without preceding ./' do
|
98
98
|
@assets.file 'folder/main.css.scss', %(@import "dep-1";\n@import "subfolder/dep-2";\nbody { background-color: $background-color; color: $color; })
|
99
99
|
@assets.file 'folder/_dep-1.css.scss', '$background-color: red;'
|
@@ -101,21 +101,21 @@ describe Sprockets::Sass do
|
|
101
101
|
asset = @env['folder/main.css']
|
102
102
|
asset.to_s.should == "body {\n background-color: red;\n color: blue; }\n"
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
105
|
it 'imports files relative to root' do
|
106
106
|
@assets.file 'folder/main.css.scss', %(@import "dep";\nbody { color: $color; })
|
107
107
|
@assets.file 'dep.css.scss', '$color: blue;'
|
108
108
|
asset = @env['folder/main.css']
|
109
109
|
asset.to_s.should == "body {\n color: blue; }\n"
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
it 'imports partials relative to root' do
|
113
113
|
@assets.file 'folder/main.css.scss', %(@import "dep";\nbody { color: $color; })
|
114
114
|
@assets.file '_dep.css.scss', '$color: blue;'
|
115
115
|
asset = @env['folder/main.css']
|
116
116
|
asset.to_s.should == "body {\n color: blue; }\n"
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
it 'shares Sass environment with other imports' do
|
120
120
|
@assets.file 'main.css.scss', %(@import "dep-1";\n@import "dep-2";)
|
121
121
|
@assets.file '_dep-1.scss', '$color: blue;'
|
@@ -123,44 +123,44 @@ describe Sprockets::Sass do
|
|
123
123
|
asset = @env['main.css']
|
124
124
|
asset.to_s.should == "body {\n color: blue; }\n"
|
125
125
|
end
|
126
|
-
|
126
|
+
|
127
127
|
it 'imports files from the assets load path' do
|
128
128
|
vendor = @root.directory 'vendor'
|
129
129
|
@env.append_path vendor.to_s
|
130
|
-
|
130
|
+
|
131
131
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
132
132
|
vendor.file 'dep.css.scss', '$color: blue;'
|
133
133
|
asset = @env['main.css']
|
134
134
|
asset.to_s.should == "body {\n color: blue; }\n"
|
135
135
|
end
|
136
|
-
|
136
|
+
|
137
137
|
it 'allows global Sass configuration' do
|
138
138
|
Sprockets::Sass.options[:style] = :compact
|
139
139
|
@assets.file 'main.css.scss', "body {\n color: blue;\n}"
|
140
|
-
|
140
|
+
|
141
141
|
asset = @env['main.css']
|
142
142
|
asset.to_s.should == "body { color: blue; }\n"
|
143
143
|
Sprockets::Sass.options.delete(:style)
|
144
144
|
end
|
145
|
-
|
145
|
+
|
146
146
|
it 'imports files from the Sass load path' do
|
147
147
|
vendor = @root.directory 'vendor'
|
148
148
|
Sprockets::Sass.options[:load_paths] = [ vendor.to_s ]
|
149
|
-
|
149
|
+
|
150
150
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
151
151
|
vendor.file 'dep.scss', '$color: blue;'
|
152
152
|
asset = @env['main.css']
|
153
153
|
asset.to_s.should == "body {\n color: blue; }\n"
|
154
154
|
Sprockets::Sass.options.delete(:load_paths)
|
155
155
|
end
|
156
|
-
|
156
|
+
|
157
157
|
it 'works with the Compass framework' do
|
158
158
|
@assets.file 'main.css.scss', %(@import "compass/css3";\nbutton { @include border-radius(5px); })
|
159
|
-
|
159
|
+
|
160
160
|
asset = @env['main.css']
|
161
161
|
asset.to_s.should include('border-radius: 5px;')
|
162
162
|
end
|
163
|
-
|
163
|
+
|
164
164
|
it 'imports globbed files' do
|
165
165
|
@assets.file 'main.css.scss', %(@import "folder/*";\nbody { color: $color; background: $bg-color; })
|
166
166
|
@assets.file 'folder/dep-1.css.scss', '$color: blue;'
|
@@ -172,14 +172,14 @@ describe Sprockets::Sass do
|
|
172
172
|
it 'adds dependencies when imported' do
|
173
173
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
174
174
|
dep = @assets.file 'dep.css.scss', '$color: blue;'
|
175
|
-
|
175
|
+
|
176
176
|
asset = @env['main.css']
|
177
177
|
asset.should be_fresh(@env)
|
178
|
-
|
178
|
+
|
179
179
|
mtime = Time.now + 1
|
180
180
|
dep.open('w') { |f| f.write '$color: red;' }
|
181
181
|
dep.utime mtime, mtime
|
182
|
-
|
182
|
+
|
183
183
|
asset.should_not be_fresh(@env)
|
184
184
|
end
|
185
185
|
|
@@ -187,14 +187,14 @@ describe Sprockets::Sass do
|
|
187
187
|
@assets.file 'main.css.scss', %(@import "dep-1";\nbody { color: $color; })
|
188
188
|
@assets.file 'dep-1.css.scss', %(@import "dep-2";\n)
|
189
189
|
dep = @assets.file 'dep-2.css.scss', '$color: blue;'
|
190
|
-
|
190
|
+
|
191
191
|
asset = @env['main.css']
|
192
192
|
asset.should be_fresh(@env)
|
193
|
-
|
193
|
+
|
194
194
|
mtime = Time.now + 1
|
195
195
|
dep.open('w') { |f| f.write '$color: red;' }
|
196
196
|
dep.utime mtime, mtime
|
197
|
-
|
197
|
+
|
198
198
|
asset.should_not be_fresh(@env)
|
199
199
|
end
|
200
200
|
|
@@ -202,48 +202,48 @@ describe Sprockets::Sass do
|
|
202
202
|
@assets.file 'main.css.scss', %(@import "folder/*";\nbody { color: $color; background: $bg-color; })
|
203
203
|
@assets.file 'folder/_dep-1.scss', '$color: blue;'
|
204
204
|
dep = @assets.file 'folder/_dep-2.scss', '$bg-color: red;'
|
205
|
-
|
205
|
+
|
206
206
|
asset = @env['main.css']
|
207
207
|
asset.should be_fresh(@env)
|
208
|
-
|
208
|
+
|
209
209
|
mtime = Time.now + 1
|
210
210
|
dep.open('w') { |f| f.write "$bg-color: white;" }
|
211
211
|
dep.utime mtime, mtime
|
212
|
-
|
212
|
+
|
213
213
|
asset.should_not be_fresh(@env)
|
214
214
|
end
|
215
|
-
|
215
|
+
|
216
216
|
it "uses the environment's cache" do
|
217
217
|
cache = {}
|
218
218
|
@env.cache = cache
|
219
|
-
|
219
|
+
|
220
220
|
@assets.file 'main.css.scss', %($color: blue;\nbody { color: $color; })
|
221
|
-
|
221
|
+
|
222
222
|
@env['main.css'].to_s
|
223
223
|
sass_cache = cache.keys.detect { |key| key =~ /main\.css\.scss/ }
|
224
224
|
sass_cache.should_not be_nil
|
225
225
|
end
|
226
|
-
|
226
|
+
|
227
227
|
it 'adds the #asset_path helper' do
|
228
228
|
@assets.file 'asset_path.css.scss', %(body { background: url(asset-path("image.jpg")); })
|
229
229
|
@assets.file 'asset_url.css.scss', %(body { background: asset-url("image.jpg"); })
|
230
230
|
@assets.file 'asset_path_options.css.scss', %(body { background: url(asset-path("image.jpg", $digest: true, $prefix: "/themes")); })
|
231
231
|
@assets.file 'asset_url_options.css.scss', %(body { background: asset-url("image.jpg", $digest: true, $prefix: "/themes"); })
|
232
232
|
@assets.file 'image.jpg'
|
233
|
-
|
233
|
+
|
234
234
|
@env['asset_path.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
235
235
|
@env['asset_url.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
236
236
|
@env['asset_path_options.css'].to_s.should =~ %r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n)
|
237
237
|
@env['asset_url_options.css'].to_s.should =~ %r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n)
|
238
238
|
end
|
239
|
-
|
239
|
+
|
240
240
|
it 'adds the #image_path helper' do
|
241
241
|
@assets.file 'image_path.css.scss', %(body { background: url(image-path("image.jpg")); })
|
242
242
|
@assets.file 'image_url.css.scss', %(body { background: image-url("image.jpg"); })
|
243
243
|
@assets.file 'image_path_options.css.scss', %(body { background: url(image-path("image.jpg", $digest: true, $prefix: "/themes")); })
|
244
244
|
@assets.file 'image_url_options.css.scss', %(body { background: image-url("image.jpg", $digest: true, $prefix: "/themes"); })
|
245
245
|
@assets.file 'image.jpg'
|
246
|
-
|
246
|
+
|
247
247
|
@env['image_path.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
248
248
|
@env['image_url.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
249
249
|
@env['image_path_options.css'].to_s.should =~ %r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n)
|
@@ -256,26 +256,26 @@ describe Sprockets::Sass do
|
|
256
256
|
@assets.file 'font_path_options.css.scss', %(@font-face { src: url(font-path("font.ttf", $digest: true, $prefix: "/themes")); })
|
257
257
|
@assets.file 'font_url_options.css.scss', %(@font-face { src: font-url("font.ttf", $digest: true, $prefix: "/themes"); })
|
258
258
|
@assets.file 'font.ttf'
|
259
|
-
|
259
|
+
|
260
260
|
@env['font_path.css'].to_s.should == %(@font-face {\n src: url("/assets/font.ttf"); }\n)
|
261
261
|
@env['font_url.css'].to_s.should == %(@font-face {\n src: url("/assets/font.ttf"); }\n)
|
262
262
|
@env['font_path_options.css'].to_s.should =~ %r(@font-face \{\n src: url\("/themes/font-[0-9a-f]+.ttf"\); \}\n)
|
263
263
|
@env['font_url_options.css'].to_s.should =~ %r(@font-face \{\n src: url\("/themes/font-[0-9a-f]+.ttf"\); \}\n)
|
264
264
|
end
|
265
|
-
|
265
|
+
|
266
266
|
it 'adds the #asset_data_uri helper' do
|
267
267
|
@assets.file 'asset_data_uri.css.scss', %(body { background: asset-data-uri("image.jpg"); })
|
268
268
|
@assets.file 'image.jpg', File.read('spec/fixtures/image.jpg')
|
269
|
-
|
269
|
+
|
270
270
|
@env['asset_data_uri.css'].to_s.should == %(body {\n background: url(data:image/jpeg;base64,%2F9j%2F4AAQSkZJRgABAgAAZABkAAD%2F7AARRHVja3kAAQAEAAAAPAAA%2F%2B4ADkFkb2JlAGTAAAAAAf%2FbAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoKDBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f%2F8AAEQgAAQABAwERAAIRAQMRAf%2FEAEoAAQAAAAAAAAAAAAAAAAAAAAgBAQAAAAAAAAAAAAAAAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAARAQAAAAAAAAAAAAAAAAAAAAD%2F2gAMAwEAAhEDEQA%2FACoD%2F9k%3D); }\n)
|
271
271
|
end
|
272
|
-
|
272
|
+
|
273
273
|
it "mirrors Compass's #image_url helper" do
|
274
274
|
@assets.file 'image_path.css.scss', %(body { background: url(image-url("image.jpg", true)); })
|
275
275
|
@assets.file 'image_url.css.scss', %(body { background: image-url("image.jpg", false); })
|
276
276
|
@assets.file 'cache_buster.css.scss', %(body { background: image-url("image.jpg", false, true); })
|
277
277
|
@assets.file 'image.jpg'
|
278
|
-
|
278
|
+
|
279
279
|
@env['image_path.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
280
280
|
@env['image_url.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
281
281
|
@env['cache_buster.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
@@ -285,20 +285,27 @@ describe Sprockets::Sass do
|
|
285
285
|
@assets.file 'font_path.css.scss', %(@font-face { src: url(font-url("font.ttf", true)); })
|
286
286
|
@assets.file 'font_url.css.scss', %(@font-face { src: font-url("font.ttf", false); })
|
287
287
|
@assets.file 'font.ttf'
|
288
|
-
|
288
|
+
|
289
289
|
@env['font_path.css'].to_s.should == %(@font-face {\n src: url("/assets/font.ttf"); }\n)
|
290
290
|
@env['font_url.css'].to_s.should == %(@font-face {\n src: url("/assets/font.ttf"); }\n)
|
291
291
|
end
|
292
|
-
|
292
|
+
|
293
293
|
it "mirrors Sass::Rails's #asset_path helpers" do
|
294
294
|
@assets.file 'asset_path.css.scss', %(body { background: url(asset-path("image.jpg", image)); })
|
295
295
|
@assets.file 'asset_url.css.scss', %(body { background: asset-url("icon.jpg", image); })
|
296
296
|
@assets.file 'image.jpg'
|
297
|
-
|
297
|
+
|
298
298
|
@env['asset_path.css'].to_s.should == %(body {\n background: url("/assets/image.jpg"); }\n)
|
299
299
|
@env['asset_url.css'].to_s.should == %(body {\n background: url("/images/icon.jpg"); }\n)
|
300
300
|
end
|
301
301
|
|
302
|
+
it 'allows asset helpers from within Compass mixins' do
|
303
|
+
@assets.file 'bullets.css.scss', %(@import "compass";\nul { @include pretty-bullets('bullet.gif', 10px, 10px); })
|
304
|
+
@assets.file 'bullet.gif'
|
305
|
+
|
306
|
+
@env['bullets.css'].to_s.should =~ %r[background: url\("/assets/bullet\.gif"\)]
|
307
|
+
end
|
308
|
+
|
302
309
|
it 'compresses css' do
|
303
310
|
css = "div {\n color: red;\n}\n"
|
304
311
|
Sprockets::Sass::Compressor.new.compress(css).should == "div{color:red}\n"
|
data/sprockets-sass.gemspec
CHANGED
@@ -17,13 +17,13 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split('\n').map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ['lib']
|
20
|
-
|
20
|
+
|
21
21
|
s.add_dependency 'sprockets', '~> 2.0'
|
22
22
|
s.add_dependency 'tilt', '~> 1.1'
|
23
23
|
s.add_development_dependency 'appraisal', '~> 0.4'
|
24
24
|
s.add_development_dependency 'rspec', '~> 2.6'
|
25
25
|
s.add_development_dependency 'test-construct', '~> 1.2'
|
26
|
-
s.add_development_dependency 'sprockets-helpers', '~> 0.
|
26
|
+
s.add_development_dependency 'sprockets-helpers', '~> 0.7'
|
27
27
|
s.add_development_dependency 'sass', '~> 3.1'
|
28
28
|
s.add_development_dependency 'compass', '~> 0.11'
|
29
29
|
s.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: tilt
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '1.1'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.1'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: appraisal
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0.4'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.4'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rspec
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '2.6'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.6'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: test-construct
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
@@ -65,21 +85,31 @@ dependencies:
|
|
65
85
|
version: '1.2'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.2'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: sprockets-helpers
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ~>
|
75
100
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0.
|
101
|
+
version: '0.7'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.7'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: sass
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ~>
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: '3.1'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '3.1'
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: compass
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ~>
|
@@ -98,10 +133,15 @@ dependencies:
|
|
98
133
|
version: '0.11'
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0.11'
|
102
142
|
- !ruby/object:Gem::Dependency
|
103
143
|
name: rake
|
104
|
-
requirement:
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
105
145
|
none: false
|
106
146
|
requirements:
|
107
147
|
- - ! '>='
|
@@ -109,7 +149,12 @@ dependencies:
|
|
109
149
|
version: '0'
|
110
150
|
type: :development
|
111
151
|
prerelease: false
|
112
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
113
158
|
description: When using Sprockets 2.0 with Sass you will eventually run into a pretty
|
114
159
|
big issue. `//= require` directives will not allow Sass mixins, variables, etc.
|
115
160
|
to be shared between files. So you'll try to use `@import`, and that'll also blow
|
@@ -127,13 +172,22 @@ files:
|
|
127
172
|
- LICENSE
|
128
173
|
- README.md
|
129
174
|
- Rakefile
|
130
|
-
- gemfiles/compass-0.
|
131
|
-
- gemfiles/compass-0.
|
132
|
-
- gemfiles/sprockets-2.
|
133
|
-
- gemfiles/sprockets-2.
|
134
|
-
- gemfiles/sprockets-2.
|
135
|
-
- gemfiles/sprockets-2.3.gemfile
|
136
|
-
- gemfiles/sprockets-2.
|
175
|
+
- gemfiles/compass-0.11_sass-3.1.gemfile
|
176
|
+
- gemfiles/compass-0.11_sass-3.2.gemfile
|
177
|
+
- gemfiles/sprockets-2.0_sass-3.1.gemfile
|
178
|
+
- gemfiles/sprockets-2.0_sass-3.2.gemfile
|
179
|
+
- gemfiles/sprockets-2.1_sass-3.1.gemfile
|
180
|
+
- gemfiles/sprockets-2.1_sass-3.2.gemfile
|
181
|
+
- gemfiles/sprockets-2.2_sass-3.1.gemfile
|
182
|
+
- gemfiles/sprockets-2.2_sass-3.2.gemfile
|
183
|
+
- gemfiles/sprockets-2.3_sass-3.1.gemfile
|
184
|
+
- gemfiles/sprockets-2.3_sass-3.2.gemfile
|
185
|
+
- gemfiles/sprockets-2.4_sass-3.1.gemfile
|
186
|
+
- gemfiles/sprockets-2.4_sass-3.2.gemfile
|
187
|
+
- gemfiles/sprockets-2.5_sass-3.1.gemfile
|
188
|
+
- gemfiles/sprockets-2.5_sass-3.2.gemfile
|
189
|
+
- gemfiles/sprockets-2.6_sass-3.1.gemfile
|
190
|
+
- gemfiles/sprockets-2.6_sass-3.2.gemfile
|
137
191
|
- lib/sprockets-sass.rb
|
138
192
|
- lib/sprockets/sass.rb
|
139
193
|
- lib/sprockets/sass/cache_store.rb
|
@@ -162,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
216
|
version: '0'
|
163
217
|
segments:
|
164
218
|
- 0
|
165
|
-
hash:
|
219
|
+
hash: -176410463
|
166
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
221
|
none: false
|
168
222
|
requirements:
|
@@ -171,10 +225,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
225
|
version: '0'
|
172
226
|
segments:
|
173
227
|
- 0
|
174
|
-
hash:
|
228
|
+
hash: -176410463
|
175
229
|
requirements: []
|
176
230
|
rubyforge_project: sprockets-sass
|
177
|
-
rubygems_version: 1.8.
|
231
|
+
rubygems_version: 1.8.23
|
178
232
|
signing_key:
|
179
233
|
specification_version: 3
|
180
234
|
summary: Better Sass integration with Sprockets 2.0
|