sass-embedded 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sass/version.rb +1 -1
- metadata +6 -33
- data/.github/workflows/build.yml +0 -44
- data/.gitignore +0 -45
- data/.rubocop.yml +0 -11
- data/Gemfile +0 -4
- data/Rakefile +0 -23
- data/ext/.gitignore +0 -3
- data/sass-embedded.gemspec +0 -38
- data/test/concurrency_test.rb +0 -34
- data/test/functions_test.rb +0 -387
- data/test/importer_test.rb +0 -155
- data/test/include_paths_test.rb +0 -81
- data/test/indented_syntax_test.rb +0 -61
- data/test/input_test.rb +0 -56
- data/test/output_test.rb +0 -136
- data/test/render_error_test.rb +0 -44
- data/test/render_test.rb +0 -19
- data/test/source_maps_test.rb +0 -182
- data/test/test_helper.rb +0 -30
data/test/render_error_test.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'test_helper'
|
4
|
-
|
5
|
-
module Sass
|
6
|
-
class RenderErrorTest < MiniTest::Test
|
7
|
-
include TempFileTest
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@embedded = Embedded.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def teardown
|
14
|
-
@embedded.close
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_first_backtrace_is_stdin
|
18
|
-
template = <<~SCSS
|
19
|
-
.foo {
|
20
|
-
baz: bang;
|
21
|
-
padding top: 10px;
|
22
|
-
}
|
23
|
-
SCSS
|
24
|
-
|
25
|
-
@embedded.render(data: template)
|
26
|
-
rescue RenderError => e
|
27
|
-
expected = 'stdin:3:20'
|
28
|
-
assert_equal expected, e.backtrace.first
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_first_backtrace_is_file
|
32
|
-
temp_file('style.scss', <<~SCSS)
|
33
|
-
.foo {
|
34
|
-
baz: bang;
|
35
|
-
padding top: 10px;
|
36
|
-
}
|
37
|
-
SCSS
|
38
|
-
|
39
|
-
@embedded.render(file: 'style.scss')
|
40
|
-
rescue RenderError => e
|
41
|
-
assert e.backtrace.first.end_with? '/style.scss:3:20'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/test/render_test.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'test_helper'
|
4
|
-
|
5
|
-
module Sass
|
6
|
-
class RenderTest < MiniTest::Test
|
7
|
-
def test_sass_render
|
8
|
-
assert_equal '', ::Sass.render(data: '').css
|
9
|
-
|
10
|
-
css = <<~CSS.chomp
|
11
|
-
h1 {
|
12
|
-
font-size: 2rem;
|
13
|
-
}
|
14
|
-
CSS
|
15
|
-
|
16
|
-
assert_equal css, ::Sass.render(data: 'h1 { font-size: 2rem; }').css
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/test/source_maps_test.rb
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'test_helper'
|
4
|
-
|
5
|
-
module Sass
|
6
|
-
class SourceMapsTest < MiniTest::Test
|
7
|
-
include TempFileTest
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@embedded = Embedded.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def teardown
|
14
|
-
@embedded.close
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_no_source_map
|
18
|
-
scss = <<~SCSS
|
19
|
-
$size: 40px;
|
20
|
-
h1 {
|
21
|
-
font-size: $size;
|
22
|
-
}
|
23
|
-
SCSS
|
24
|
-
|
25
|
-
css = <<~CSS.chomp
|
26
|
-
h1 {
|
27
|
-
font-size: 40px;
|
28
|
-
}
|
29
|
-
CSS
|
30
|
-
|
31
|
-
temp_file('style.scss', scss)
|
32
|
-
|
33
|
-
result = @embedded.render(file: 'style.scss')
|
34
|
-
assert_equal css, result.css
|
35
|
-
assert_nil result.map
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_source_map_file_as_string
|
39
|
-
scss = <<~SCSS
|
40
|
-
$size: 40px;
|
41
|
-
h1 {
|
42
|
-
font-size: $size;
|
43
|
-
}
|
44
|
-
SCSS
|
45
|
-
|
46
|
-
css = <<~CSS.chomp
|
47
|
-
h1 {
|
48
|
-
font-size: 40px;
|
49
|
-
}
|
50
|
-
|
51
|
-
/*# sourceMappingURL=out.map */
|
52
|
-
CSS
|
53
|
-
|
54
|
-
temp_file('style.scss', scss)
|
55
|
-
|
56
|
-
result = @embedded.render(file: 'style.scss',
|
57
|
-
source_map: 'out.map')
|
58
|
-
assert_equal css, result.css
|
59
|
-
JSON.parse(result.map)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_source_map_true_without_out_file_has_no_effect
|
63
|
-
scss = <<~SCSS
|
64
|
-
$size: 40px;
|
65
|
-
h1 {
|
66
|
-
font-size: $size;
|
67
|
-
}
|
68
|
-
SCSS
|
69
|
-
|
70
|
-
css = <<~CSS.chomp
|
71
|
-
h1 {
|
72
|
-
font-size: 40px;
|
73
|
-
}
|
74
|
-
CSS
|
75
|
-
|
76
|
-
temp_file('style.scss', scss)
|
77
|
-
|
78
|
-
result = @embedded.render(file: 'style.scss',
|
79
|
-
source_map: true)
|
80
|
-
assert_equal css, result.css
|
81
|
-
assert_nil result.map
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_source_map_true_with_out_file
|
85
|
-
scss = <<~SCSS
|
86
|
-
$size: 40px;
|
87
|
-
h1 {
|
88
|
-
font-size: $size;
|
89
|
-
}
|
90
|
-
SCSS
|
91
|
-
|
92
|
-
css = <<~CSS.chomp
|
93
|
-
h1 {
|
94
|
-
font-size: 40px;
|
95
|
-
}
|
96
|
-
|
97
|
-
/*# sourceMappingURL=out.css.map */
|
98
|
-
CSS
|
99
|
-
|
100
|
-
temp_file('style.scss', scss)
|
101
|
-
|
102
|
-
result = @embedded.render(file: 'style.scss',
|
103
|
-
source_map: true,
|
104
|
-
out_file: 'out.css')
|
105
|
-
assert_equal css, result.css
|
106
|
-
JSON.parse(result.map)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_omit_source_map_url
|
110
|
-
scss = <<~SCSS
|
111
|
-
$size: 40px;
|
112
|
-
h1 {
|
113
|
-
font-size: $size;
|
114
|
-
}
|
115
|
-
SCSS
|
116
|
-
|
117
|
-
css = <<~CSS.chomp
|
118
|
-
h1 {
|
119
|
-
font-size: 40px;
|
120
|
-
}
|
121
|
-
CSS
|
122
|
-
|
123
|
-
temp_file('style.scss', scss)
|
124
|
-
|
125
|
-
result = @embedded.render(file: 'style.scss',
|
126
|
-
source_map: 'out.map',
|
127
|
-
omit_source_map_url: true)
|
128
|
-
assert_equal css, result.css
|
129
|
-
JSON.parse(result.map)
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_source_map_embedded
|
133
|
-
scss = <<~SCSS
|
134
|
-
$size: 40px;
|
135
|
-
h1 {
|
136
|
-
font-size: $size;
|
137
|
-
}
|
138
|
-
SCSS
|
139
|
-
|
140
|
-
css = <<~CSS.chomp
|
141
|
-
h1 {
|
142
|
-
font-size: 40px;
|
143
|
-
}
|
144
|
-
|
145
|
-
/*# sourceMappingURL=data:application/json;base64,
|
146
|
-
CSS
|
147
|
-
|
148
|
-
temp_file('style.scss', scss)
|
149
|
-
|
150
|
-
result = @embedded.render(file: 'style.scss',
|
151
|
-
source_map: 'out.map',
|
152
|
-
source_map_embed: true)
|
153
|
-
assert result.css.start_with? css
|
154
|
-
JSON.parse(result.map)
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_source_map_root
|
158
|
-
scss = <<~SCSS
|
159
|
-
$size: 40px;
|
160
|
-
h1 {
|
161
|
-
font-size: $size;
|
162
|
-
}
|
163
|
-
SCSS
|
164
|
-
|
165
|
-
css = <<~CSS.chomp
|
166
|
-
h1 {
|
167
|
-
font-size: 40px;
|
168
|
-
}
|
169
|
-
|
170
|
-
/*# sourceMappingURL=out.map */
|
171
|
-
CSS
|
172
|
-
|
173
|
-
temp_file('style.scss', scss)
|
174
|
-
|
175
|
-
result = @embedded.render(file: 'style.scss',
|
176
|
-
source_map: 'out.map',
|
177
|
-
source_map_root: 'assets')
|
178
|
-
assert_equal css, result.css
|
179
|
-
assert_equal 'assets', JSON.parse(result.map)['sourceRoot']
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'minitest/autorun'
|
6
|
-
require 'minitest/pride'
|
7
|
-
require 'minitest/around/unit'
|
8
|
-
|
9
|
-
require_relative '../lib/sass'
|
10
|
-
|
11
|
-
module TempFileTest
|
12
|
-
def around
|
13
|
-
pwd = Dir.pwd
|
14
|
-
tmpdir = Dir.mktmpdir
|
15
|
-
Dir.chdir tmpdir
|
16
|
-
yield
|
17
|
-
Dir.chdir pwd
|
18
|
-
FileUtils.rm_rf(tmpdir)
|
19
|
-
end
|
20
|
-
|
21
|
-
def temp_file(filename, contents)
|
22
|
-
File.open(filename, 'w') do |file|
|
23
|
-
file.write(contents)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def temp_dir(directory)
|
28
|
-
Dir.mkdir(directory)
|
29
|
-
end
|
30
|
-
end
|