sass 3.4.25 → 3.5.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +1 -1
- data/Rakefile +13 -157
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/lib/sass.rb +3 -10
- data/lib/sass/cache_stores/filesystem.rb +1 -1
- data/lib/sass/css.rb +2 -3
- data/lib/sass/engine.rb +46 -32
- data/lib/sass/environment.rb +27 -6
- data/lib/sass/error.rb +5 -5
- data/lib/sass/exec/base.rb +3 -12
- data/lib/sass/features.rb +1 -0
- data/lib/sass/importers/filesystem.rb +2 -2
- data/lib/sass/plugin.rb +1 -1
- data/lib/sass/plugin/compiler.rb +21 -51
- data/lib/sass/plugin/configuration.rb +1 -1
- data/lib/sass/plugin/rack.rb +3 -3
- data/lib/sass/plugin/staleness_checker.rb +3 -3
- data/lib/sass/railtie.rb +1 -1
- data/lib/sass/script.rb +3 -3
- data/lib/sass/script/functions.rb +238 -47
- data/lib/sass/script/lexer.rb +8 -6
- data/lib/sass/script/parser.rb +76 -75
- data/lib/sass/script/tree/funcall.rb +35 -30
- data/lib/sass/script/tree/list_literal.rb +23 -8
- data/lib/sass/script/tree/map_literal.rb +2 -2
- data/lib/sass/script/tree/node.rb +2 -10
- data/lib/sass/script/tree/operation.rb +16 -50
- data/lib/sass/script/value.rb +2 -0
- data/lib/sass/script/value/arg_list.rb +1 -1
- data/lib/sass/script/value/base.rb +20 -3
- data/lib/sass/script/value/callable.rb +25 -0
- data/lib/sass/script/value/color.rb +10 -10
- data/lib/sass/script/value/function.rb +19 -0
- data/lib/sass/script/value/helpers.rb +16 -7
- data/lib/sass/script/value/list.rb +33 -12
- data/lib/sass/script/value/map.rb +2 -2
- data/lib/sass/script/value/number.rb +3 -3
- data/lib/sass/script/value/string.rb +12 -5
- data/lib/sass/scss/parser.rb +101 -45
- data/lib/sass/scss/rx.rb +5 -11
- data/lib/sass/scss/static_parser.rb +0 -7
- data/lib/sass/selector.rb +4 -0
- data/lib/sass/selector/abstract_sequence.rb +5 -5
- data/lib/sass/selector/comma_sequence.rb +3 -15
- data/lib/sass/selector/pseudo.rb +4 -0
- data/lib/sass/selector/sequence.rb +30 -3
- data/lib/sass/selector/simple.rb +13 -7
- data/lib/sass/selector/simple_sequence.rb +1 -1
- data/lib/sass/shared.rb +3 -5
- data/lib/sass/source/map.rb +4 -4
- data/lib/sass/source/position.rb +4 -4
- data/lib/sass/stack.rb +21 -1
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/comment_node.rb +1 -1
- data/lib/sass/tree/node.rb +3 -3
- data/lib/sass/tree/prop_node.rb +46 -54
- data/lib/sass/tree/rule_node.rb +7 -15
- data/lib/sass/tree/visitors/check_nesting.rb +1 -1
- data/lib/sass/tree/visitors/convert.rb +2 -3
- data/lib/sass/tree/visitors/cssize.rb +1 -10
- data/lib/sass/tree/visitors/deep_copy.rb +2 -2
- data/lib/sass/tree/visitors/perform.rb +23 -12
- data/lib/sass/tree/visitors/set_options.rb +1 -1
- data/lib/sass/tree/visitors/to_css.rb +46 -12
- data/lib/sass/util.rb +16 -321
- data/lib/sass/util/multibyte_string_scanner.rb +127 -131
- data/lib/sass/util/normalized_map.rb +1 -8
- data/lib/sass/version.rb +2 -2
- data/test/sass-spec.yml +1 -1
- data/test/sass/compiler_test.rb +4 -14
- data/test/sass/conversion_test.rb +113 -162
- data/test/sass/css2sass_test.rb +17 -19
- data/test/sass/css_variable_test.rb +176 -70
- data/test/sass/encoding_test.rb +2 -32
- data/test/sass/engine_test.rb +114 -65
- data/test/sass/extend_test.rb +37 -51
- data/test/sass/functions_test.rb +57 -15
- data/test/sass/importer_test.rb +2 -2
- data/test/sass/more_templates/more1.sass +10 -10
- data/test/sass/more_templates/more_import.sass +2 -2
- data/test/sass/plugin_test.rb +9 -12
- data/test/sass/script_conversion_test.rb +9 -0
- data/test/sass/script_test.rb +38 -48
- data/test/sass/scss/css_test.rb +5 -19
- data/test/sass/scss/scss_test.rb +58 -39
- data/test/sass/source_map_test.rb +26 -28
- data/test/sass/templates/_partial.sass +1 -1
- data/test/sass/templates/basic.sass +10 -10
- data/test/sass/templates/bork1.sass +1 -1
- data/test/sass/templates/bork5.sass +1 -1
- data/test/sass/templates/compact.sass +10 -10
- data/test/sass/templates/complex.sass +187 -187
- data/test/sass/templates/compressed.sass +10 -10
- data/test/sass/templates/expanded.sass +10 -10
- data/test/sass/templates/import.sass +2 -2
- data/test/sass/templates/importee.sass +3 -3
- data/test/sass/templates/mixins.sass +22 -22
- data/test/sass/templates/multiline.sass +4 -4
- data/test/sass/templates/nested.sass +13 -13
- data/test/sass/templates/parent_ref.sass +12 -12
- data/test/sass/templates/script.sass +70 -70
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
- data/test/sass/templates/subdir/subdir.sass +3 -3
- data/test/sass/templates/units.sass +10 -10
- data/test/sass/util/multibyte_string_scanner_test.rb +139 -149
- data/test/sass/util_test.rb +0 -36
- data/test/test_helper.rb +39 -0
- metadata +30 -57
- data/extra/sass-spec-ref.sh +0 -32
- data/lib/sass/deprecation.rb +0 -55
- data/lib/sass/script/css_variable_warning.rb +0 -52
- data/lib/sass/util/cross_platform_random.rb +0 -19
- data/lib/sass/util/ordered_hash.rb +0 -192
- data/test/sass/results/import_charset_1_8.css +0 -5
- data/test/sass/templates/import_charset_1_8.sass +0 -6
- data/vendor/listen/CHANGELOG.md +0 -1
- data/vendor/listen/CONTRIBUTING.md +0 -38
- data/vendor/listen/Gemfile +0 -20
- data/vendor/listen/Guardfile +0 -8
- data/vendor/listen/LICENSE +0 -20
- data/vendor/listen/README.md +0 -349
- data/vendor/listen/Rakefile +0 -5
- data/vendor/listen/Vagrantfile +0 -96
- data/vendor/listen/lib/listen.rb +0 -54
- data/vendor/listen/lib/listen/adapter.rb +0 -327
- data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
- data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
- data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
- data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
- data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
- data/vendor/listen/lib/listen/directory_record.rb +0 -406
- data/vendor/listen/lib/listen/listener.rb +0 -323
- data/vendor/listen/lib/listen/turnstile.rb +0 -32
- data/vendor/listen/lib/listen/version.rb +0 -3
- data/vendor/listen/listen.gemspec +0 -28
- data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
- data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
- data/vendor/listen/spec/listen/listener_spec.rb +0 -258
- data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
- data/vendor/listen/spec/listen_spec.rb +0 -67
- data/vendor/listen/spec/spec_helper.rb +0 -25
- data/vendor/listen/spec/support/adapter_helper.rb +0 -666
- data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
- data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
- data/vendor/listen/spec/support/listeners_helper.rb +0 -179
- data/vendor/listen/spec/support/platform_helper.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c783fad5337d350de6a05eb9157e74ea987103f
|
4
|
+
data.tar.gz: 20fb9514c3b8f7cbfd6fb72f1a0cc021e38b0993
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89716ff7357b7a3ba527b5b8fd2e6da59b2b501f58930a6ee612611f34a26272fb5c13047aa1c06491da53ac7f9bf924710ca2478e9c04f354c07eb46d2f3841
|
7
|
+
data.tar.gz: 8b24c606daa11c7a38a557bf4efcb7e7d2b72411d8f8f0338af40bff915e80c048f0aaf9db93f0abb4202384599564a972388aa0789198e257fb2c95a2994baa
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Sass [![Gem Version](https://badge.fury.io/rb/sass.
|
1
|
+
# Sass [![Gem Version](https://badge.fury.io/rb/sass.png)](http://badge.fury.io/rb/sass) [![Inline docs](http://inch-ci.org/github/sass/sass.svg)](http://inch-ci.org/github/sass/sass)
|
2
2
|
|
3
3
|
**Sass makes CSS fun again**. Sass is an extension of CSS,
|
4
4
|
adding nested rules, variables, mixins, selector inheritance, and more.
|
data/Rakefile
CHANGED
@@ -12,42 +12,8 @@ task :default => :test
|
|
12
12
|
|
13
13
|
require 'rake/testtask'
|
14
14
|
|
15
|
-
LINE_SIZE = 80
|
16
|
-
DECORATION_CHAR = '#'
|
17
|
-
|
18
|
-
def print_header(string)
|
19
|
-
length = string.length
|
20
|
-
puts DECORATION_CHAR * LINE_SIZE
|
21
|
-
puts string.center(length + 2, ' ').center(LINE_SIZE, DECORATION_CHAR)
|
22
|
-
puts DECORATION_CHAR * LINE_SIZE
|
23
|
-
end
|
24
|
-
|
25
15
|
desc "Run all tests"
|
26
|
-
task :test
|
27
|
-
test_cases = [
|
28
|
-
{
|
29
|
-
'env' => {'MATHN' => 'true'},
|
30
|
-
'tasks' => ['test:ruby', 'test:spec', :rubocop]
|
31
|
-
},
|
32
|
-
{
|
33
|
-
'env' => {'MATHN' => 'false'},
|
34
|
-
'tasks' => ['test:ruby']
|
35
|
-
}
|
36
|
-
]
|
37
|
-
|
38
|
-
test_cases.each do |test_case|
|
39
|
-
env = test_case['env']
|
40
|
-
tasks = test_case['tasks']
|
41
|
-
|
42
|
-
env.each do |key, value|
|
43
|
-
ENV[key] = value
|
44
|
-
end
|
45
|
-
tasks.each do |task|
|
46
|
-
print_header("Running task: #{task}, env: #{env}")
|
47
|
-
Rake::Task[task].execute
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
16
|
+
task :test => ["test:ruby", "test:spec"]
|
51
17
|
|
52
18
|
namespace :test do
|
53
19
|
desc "Run the ruby tests (without sass-spec)"
|
@@ -82,7 +48,7 @@ namespace :test do
|
|
82
48
|
end
|
83
49
|
default_options = {
|
84
50
|
:spec_directory => SassSpec::SPEC_DIR,
|
85
|
-
:engine_adapter => SassEngineAdapter.new,
|
51
|
+
:engine_adapter => SassEngineAdapter.new("sass"),
|
86
52
|
:generate => false,
|
87
53
|
:tap => false,
|
88
54
|
:skip => false,
|
@@ -110,26 +76,31 @@ def ruby_version_at_least?(version_string)
|
|
110
76
|
ruby_version >= version
|
111
77
|
end
|
112
78
|
|
113
|
-
|
79
|
+
if ruby_version_at_least?("2.2.0") &&
|
80
|
+
(ENV.has_key?("RUBOCOP") && ENV["RUBOCOP"] == "true" ||
|
81
|
+
!(ENV.has_key?("RUBOCOP") || ENV.has_key?("TEST")))
|
114
82
|
require 'rubocop/rake_task'
|
115
83
|
RuboCop = Rubocop unless defined?(RuboCop)
|
116
84
|
RuboCop::RakeTask.new do |t|
|
117
85
|
t.patterns = FileList["lib/**/*"]
|
118
86
|
end
|
119
|
-
|
87
|
+
else
|
120
88
|
task :rubocop do
|
121
|
-
puts "
|
89
|
+
puts "Skipping rubocop style check."
|
90
|
+
next if ENV.has_key?("RUBOCOP") && ENV["RUBOCOP"] != "true"
|
122
91
|
puts "Passing this check is required in order for your patch to be accepted."
|
123
|
-
puts "
|
92
|
+
puts "Use Ruby 2.2 or greater and then run the style check with: rake rubocop"
|
124
93
|
end
|
125
94
|
end
|
126
95
|
|
96
|
+
task :test => :rubocop
|
97
|
+
|
127
98
|
# ----- Packaging -----
|
128
99
|
|
129
100
|
# Don't use Rake::GemPackageTast because we want prerequisites to run
|
130
101
|
# before we load the gemspec.
|
131
102
|
desc "Build all the packages."
|
132
|
-
task :package => [:revision_file, :date_file, :
|
103
|
+
task :package => [:revision_file, :date_file, :permissions] do
|
133
104
|
version = get_version
|
134
105
|
File.open(scope('VERSION'), 'w') {|f| f.puts(version)}
|
135
106
|
load scope('sass.gemspec')
|
@@ -222,49 +193,10 @@ def changed_since?(rev, *files)
|
|
222
193
|
return !$?.success?
|
223
194
|
end
|
224
195
|
|
225
|
-
task :submodules do
|
226
|
-
if File.exist?(File.dirname(__FILE__) + "/.git")
|
227
|
-
sh %{git submodule sync}
|
228
|
-
sh %{git submodule update --init}
|
229
|
-
elsif !File.exist?(File.dirname(__FILE__) + "/vendor/listen/lib")
|
230
|
-
warn <<WARN
|
231
|
-
WARNING: vendor/listen doesn't exist, and this isn't a git repository so
|
232
|
-
I can't get it automatically!
|
233
|
-
WARN
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
task :release_edge do
|
238
|
-
ensure_git_cleanup do
|
239
|
-
puts "#{'=' * 50} Running rake release_edge"
|
240
|
-
|
241
|
-
sh %{git checkout master}
|
242
|
-
sh %{git reset --hard origin/master}
|
243
|
-
sh %{rake package}
|
244
|
-
version = get_version
|
245
|
-
if version.include?('.rc.')
|
246
|
-
puts "#{'=' * 20} Not releasing edge gem for RC version"
|
247
|
-
next
|
248
|
-
end
|
249
|
-
|
250
|
-
sh %{gem push pkg/sass-#{version}.gem}
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
196
|
# Get the version string. If this is being installed from Git,
|
255
197
|
# this includes the proper prerelease version.
|
256
198
|
def get_version
|
257
|
-
|
258
|
-
return written_version unless File.exist?(scope('.git'))
|
259
|
-
|
260
|
-
# Get the current master branch version
|
261
|
-
version = written_version.split('.')
|
262
|
-
version.map! {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
|
263
|
-
return written_version unless version.size == 5 && version[3] == "alpha" # prerelease
|
264
|
-
|
265
|
-
return written_version if (commit_count = `git log --pretty=oneline HEAD ^stable | wc -l`).empty?
|
266
|
-
version[4] = commit_count.strip
|
267
|
-
version.join('.')
|
199
|
+
File.read(scope('VERSION').strip)
|
268
200
|
end
|
269
201
|
|
270
202
|
task :watch_for_update do
|
@@ -336,27 +268,6 @@ rescue LoadError
|
|
336
268
|
task :yard => :rdoc
|
337
269
|
end
|
338
270
|
|
339
|
-
task :pages do
|
340
|
-
ensure_git_cleanup do
|
341
|
-
puts "#{'=' * 50} Running rake pages"
|
342
|
-
sh %{git checkout sass-pages}
|
343
|
-
sh %{git reset --hard origin/sass-pages}
|
344
|
-
|
345
|
-
Dir.chdir("/var/www/sass-pages") do
|
346
|
-
sh %{git fetch origin}
|
347
|
-
|
348
|
-
sh %{git checkout stable}
|
349
|
-
sh %{git reset --hard origin/stable}
|
350
|
-
|
351
|
-
sh %{git checkout sass-pages}
|
352
|
-
sh %{git reset --hard origin/sass-pages}
|
353
|
-
sh %{rake build --trace}
|
354
|
-
sh %{mkdir -p tmp}
|
355
|
-
sh %{touch tmp/restart.txt}
|
356
|
-
end
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
271
|
# ----- Coverage -----
|
361
272
|
|
362
273
|
begin
|
@@ -396,58 +307,3 @@ END
|
|
396
307
|
RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
|
397
308
|
end
|
398
309
|
rescue LoadError; end
|
399
|
-
|
400
|
-
# ----- Handling Updates -----
|
401
|
-
|
402
|
-
def email_on_error
|
403
|
-
yield
|
404
|
-
rescue Exception => e
|
405
|
-
IO.popen("sendmail nex342@gmail.com", "w") do |sm|
|
406
|
-
sm << "From: nex3@nex-3.com\n" <<
|
407
|
-
"To: nex342@gmail.com\n" <<
|
408
|
-
"Subject: Exception when running rake #{Rake.application.top_level_tasks.join(', ')}\n" <<
|
409
|
-
e.message << "\n\n" <<
|
410
|
-
e.backtrace.join("\n")
|
411
|
-
end
|
412
|
-
ensure
|
413
|
-
raise e if e
|
414
|
-
end
|
415
|
-
|
416
|
-
def ensure_git_cleanup
|
417
|
-
email_on_error {yield}
|
418
|
-
ensure
|
419
|
-
sh %{git reset --hard HEAD}
|
420
|
-
sh %{git clean -xdf}
|
421
|
-
sh %{git checkout master}
|
422
|
-
end
|
423
|
-
|
424
|
-
task :handle_update do
|
425
|
-
email_on_error do
|
426
|
-
unless ENV["REF"] =~ %r{^refs/heads/(master|stable|sass-pages)$}
|
427
|
-
puts "#{'=' * 20} Ignoring rake handle_update REF=#{ENV["REF"].inspect}"
|
428
|
-
next
|
429
|
-
end
|
430
|
-
branch = $1
|
431
|
-
|
432
|
-
puts
|
433
|
-
puts
|
434
|
-
puts '=' * 150
|
435
|
-
puts "Running rake handle_update REF=#{ENV["REF"].inspect}"
|
436
|
-
|
437
|
-
sh %{git fetch origin}
|
438
|
-
sh %{git checkout stable}
|
439
|
-
sh %{git reset --hard origin/stable}
|
440
|
-
sh %{git checkout master}
|
441
|
-
sh %{git reset --hard origin/master}
|
442
|
-
|
443
|
-
case branch
|
444
|
-
when "master"
|
445
|
-
sh %{rake release_edge --trace}
|
446
|
-
when "stable", "sass-pages"
|
447
|
-
sh %{rake pages --trace}
|
448
|
-
end
|
449
|
-
|
450
|
-
puts 'Done running handle_update'
|
451
|
-
puts '=' * 150
|
452
|
-
end
|
453
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.5.0-rc.1
|
data/VERSION_DATE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
30 August 2016 22:11:04 UTC
|
data/VERSION_NAME
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Bleeding Edge
|
data/lib/sass.rb
CHANGED
@@ -47,7 +47,7 @@ module Sass
|
|
47
47
|
#
|
48
48
|
# @param contents [String] The contents of the Sass file.
|
49
49
|
# @param options [{Symbol => Object}] An options hash;
|
50
|
-
# see {file:SASS_REFERENCE.md#
|
50
|
+
# see {file:SASS_REFERENCE.md#options the Sass options documentation}
|
51
51
|
# @raise [Sass::SyntaxError] if there's an error in the document
|
52
52
|
# @raise [Encoding::UndefinedConversionError] if the source encoding
|
53
53
|
# cannot be converted to UTF-8
|
@@ -69,7 +69,7 @@ module Sass
|
|
69
69
|
#
|
70
70
|
# @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
|
71
71
|
# @param options [{Symbol => Object}] An options hash;
|
72
|
-
# see {file:SASS_REFERENCE.md#
|
72
|
+
# see {file:SASS_REFERENCE.md#options the Sass options documentation}
|
73
73
|
# @return [String] The compiled CSS.
|
74
74
|
#
|
75
75
|
# @overload compile_file(filename, css_filename, options = {})
|
@@ -77,7 +77,7 @@ module Sass
|
|
77
77
|
#
|
78
78
|
# @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
|
79
79
|
# @param options [{Symbol => Object}] An options hash;
|
80
|
-
# see {file:SASS_REFERENCE.md#
|
80
|
+
# see {file:SASS_REFERENCE.md#options the Sass options documentation}
|
81
81
|
# @param css_filename [String] The location to which to write the compiled CSS.
|
82
82
|
def self.compile_file(filename, *args)
|
83
83
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
@@ -100,10 +100,3 @@ require 'sass/engine'
|
|
100
100
|
require 'sass/plugin' if defined?(Merb::Plugins)
|
101
101
|
require 'sass/railtie'
|
102
102
|
require 'sass/features'
|
103
|
-
|
104
|
-
if Sass::Util.ruby1?
|
105
|
-
Sass::Util.sass_warn(
|
106
|
-
"DEPRECATION WARNING:\n" +
|
107
|
-
"Sass 3.5 will no longer support Ruby #{RUBY_VERSION}.\n" +
|
108
|
-
"Please upgrade to Ruby 2.0.0 or greater as soon as possible.\n")
|
109
|
-
end
|
@@ -52,7 +52,7 @@ module Sass
|
|
52
52
|
# @param key [String]
|
53
53
|
# @return [String] The path to the cache file.
|
54
54
|
def path_to(key)
|
55
|
-
key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" %
|
55
|
+
key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" % c.ord}
|
56
56
|
File.join(cache_location, key)
|
57
57
|
end
|
58
58
|
end
|
data/lib/sass/css.rb
CHANGED
@@ -18,7 +18,7 @@ module Sass
|
|
18
18
|
# that can be converted to Unicode.
|
19
19
|
# If the stylesheet contains an `@charset` declaration,
|
20
20
|
# that overrides the Ruby encoding
|
21
|
-
# (see {file:SASS_REFERENCE.md#
|
21
|
+
# (see {file:SASS_REFERENCE.md#encodings the encoding documentation})
|
22
22
|
# @option options :old [Boolean] (false)
|
23
23
|
# Whether or not to output old property syntax
|
24
24
|
# (`:color blue` as opposed to `color: blue`).
|
@@ -51,8 +51,7 @@ module Sass
|
|
51
51
|
raise err
|
52
52
|
end
|
53
53
|
|
54
|
-
# Returns the original encoding of the document
|
55
|
-
# or `nil` under Ruby 1.8.
|
54
|
+
# Returns the original encoding of the document.
|
56
55
|
#
|
57
56
|
# @return [Encoding, nil]
|
58
57
|
# @raise [Encoding::UndefinedConversionError] if the source encoding
|
data/lib/sass/engine.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'set'
|
2
2
|
require 'digest/sha1'
|
3
3
|
require 'sass/cache_stores'
|
4
|
-
require 'sass/deprecation'
|
5
4
|
require 'sass/source/position'
|
6
5
|
require 'sass/source/range'
|
7
6
|
require 'sass/source/map'
|
@@ -80,7 +79,13 @@ module Sass
|
|
80
79
|
#
|
81
80
|
# `type`: `String`
|
82
81
|
# : The user-friendly name of the type of the callable.
|
83
|
-
|
82
|
+
#
|
83
|
+
# `origin`: `Symbol`
|
84
|
+
# : From whence comes the callable: `:stylesheet`, `:builtin`, `:css`
|
85
|
+
# A callable with an origin of `:stylesheet` was defined in the stylesheet itself.
|
86
|
+
# A callable with an origin of `:builtin` was defined in ruby.
|
87
|
+
# A callable (function) with an origin of `:css` returns a function call with arguments to CSS.
|
88
|
+
Callable = Struct.new(:name, :args, :splat, :environment, :tree, :has_content, :type, :origin)
|
84
89
|
|
85
90
|
# This class handles the parsing and compilation of the Sass template.
|
86
91
|
# Example usage:
|
@@ -90,20 +95,18 @@ module Sass
|
|
90
95
|
# output = sass_engine.render
|
91
96
|
# puts output
|
92
97
|
class Engine
|
93
|
-
@@old_property_deprecation = Deprecation.new
|
94
|
-
|
95
98
|
# A line of Sass code.
|
96
99
|
#
|
97
100
|
# `text`: `String`
|
98
101
|
# : The text in the line, without any whitespace at the beginning or end.
|
99
102
|
#
|
100
|
-
# `tabs`: `
|
103
|
+
# `tabs`: `Fixnum`
|
101
104
|
# : The level of indentation of the line.
|
102
105
|
#
|
103
|
-
# `index`: `
|
106
|
+
# `index`: `Fixnum`
|
104
107
|
# : The line number in the original document.
|
105
108
|
#
|
106
|
-
# `offset`: `
|
109
|
+
# `offset`: `Fixnum`
|
107
110
|
# : The number of bytes in on the line that the text begins.
|
108
111
|
# This ends up being the number of bytes of leading whitespace.
|
109
112
|
#
|
@@ -171,7 +174,7 @@ module Sass
|
|
171
174
|
# default values and resolving aliases.
|
172
175
|
#
|
173
176
|
# @param options [{Symbol => Object}] The options hash;
|
174
|
-
# see {file:SASS_REFERENCE.md#
|
177
|
+
# see {file:SASS_REFERENCE.md#options the Sass options documentation}
|
175
178
|
# @return [{Symbol => Object}] The normalized options hash.
|
176
179
|
# @private
|
177
180
|
def self.normalize_options(options)
|
@@ -225,7 +228,7 @@ module Sass
|
|
225
228
|
#
|
226
229
|
# @param filename [String] The path to the Sass or SCSS file
|
227
230
|
# @param options [{Symbol => Object}] The options hash;
|
228
|
-
# See {file:SASS_REFERENCE.md#
|
231
|
+
# See {file:SASS_REFERENCE.md#options the Sass options documentation}.
|
229
232
|
# @return [Sass::Engine] The Engine for the given Sass or SCSS file.
|
230
233
|
# @raise [Sass::SyntaxError] if there's an error in the document.
|
231
234
|
def self.for_file(filename, options)
|
@@ -243,7 +246,7 @@ module Sass
|
|
243
246
|
end
|
244
247
|
|
245
248
|
# The options for the Sass engine.
|
246
|
-
# See {file:SASS_REFERENCE.md#
|
249
|
+
# See {file:SASS_REFERENCE.md#options the Sass options documentation}.
|
247
250
|
#
|
248
251
|
# @return [{Symbol => Object}]
|
249
252
|
attr_reader :options
|
@@ -260,9 +263,9 @@ module Sass
|
|
260
263
|
# that can be converted to Unicode.
|
261
264
|
# If the template contains an `@charset` declaration,
|
262
265
|
# that overrides the Ruby encoding
|
263
|
-
# (see {file:SASS_REFERENCE.md#
|
266
|
+
# (see {file:SASS_REFERENCE.md#encodings the encoding documentation})
|
264
267
|
# @param options [{Symbol => Object}] An options hash.
|
265
|
-
# See {file:SASS_REFERENCE.md#
|
268
|
+
# See {file:SASS_REFERENCE.md#options the Sass options documentation}.
|
266
269
|
# @see {Sass::Engine.for_file}
|
267
270
|
# @see {Sass::Plugin}
|
268
271
|
def initialize(template, options = {})
|
@@ -316,8 +319,7 @@ module Sass
|
|
316
319
|
end
|
317
320
|
end
|
318
321
|
|
319
|
-
# Returns the original encoding of the document
|
320
|
-
# or `nil` under Ruby 1.8.
|
322
|
+
# Returns the original encoding of the document.
|
321
323
|
#
|
322
324
|
# @return [Encoding, nil]
|
323
325
|
# @raise [Encoding::UndefinedConversionError] if the source encoding
|
@@ -386,7 +388,7 @@ ERR
|
|
386
388
|
rendered << "\n" if rendered[-1] != ?\n
|
387
389
|
rendered << "\n" unless compressed
|
388
390
|
rendered << "/*# sourceMappingURL="
|
389
|
-
rendered <<
|
391
|
+
rendered << URI::DEFAULT_PARSER.escape(sourcemap_uri)
|
390
392
|
rendered << " */\n"
|
391
393
|
return rendered, sourcemap
|
392
394
|
end
|
@@ -628,11 +630,6 @@ WARNING
|
|
628
630
|
raise SyntaxError.new("Invalid property: \"#{line.text}\".",
|
629
631
|
:line => @line) if name.nil? || value.nil?
|
630
632
|
|
631
|
-
@@old_property_deprecation.warn(@options[:filename], @line, <<WARNING)
|
632
|
-
Old-style properties like "#{line.text}" are deprecated and will be an error in future versions of Sass.
|
633
|
-
Use "#{name}: #{value}" instead.
|
634
|
-
WARNING
|
635
|
-
|
636
633
|
value_start_offset = name_end_offset = name_start_offset + name.length
|
637
634
|
unless value.empty?
|
638
635
|
# +1 and -1 both compensate for the leading ':', which is part of line.text
|
@@ -695,7 +692,14 @@ WARNING
|
|
695
692
|
end
|
696
693
|
|
697
694
|
name = line.text[0...scanner.pos]
|
698
|
-
|
695
|
+
could_be_property =
|
696
|
+
if name.start_with?('--')
|
697
|
+
(scanned = scanner.scan(/\s*:/))
|
698
|
+
else
|
699
|
+
(scanned = scanner.scan(/\s*:(?:\s+|$)/))
|
700
|
+
end
|
701
|
+
|
702
|
+
if could_be_property # test for a property
|
699
703
|
offset += scanned.length
|
700
704
|
property = parse_property(name, res, scanner.rest, :new, line, offset)
|
701
705
|
property.name_source_range = ident_range
|
@@ -722,22 +726,32 @@ WARNING
|
|
722
726
|
# rubocop:disable ParameterLists
|
723
727
|
def parse_property(name, parsed_name, value, prop, line, start_offset)
|
724
728
|
# rubocop:enable ParameterLists
|
725
|
-
|
726
|
-
|
729
|
+
|
730
|
+
if name.start_with?('--')
|
731
|
+
unless line.children.empty?
|
732
|
+
raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath custom properties.",
|
733
|
+
:line => @line + 1)
|
734
|
+
end
|
735
|
+
|
736
|
+
parser = Sass::SCSS::Parser.new(value,
|
737
|
+
@options[:filename], @options[:importer],
|
738
|
+
@line, to_parser_offset(@offset))
|
739
|
+
parsed_value = parser.parse_declaration_value
|
740
|
+
end_offset = start_offset + value.length
|
741
|
+
elsif value.strip.empty?
|
742
|
+
parsed_value = [Sass::Script::Tree::Literal.new(Sass::Script::Value::String.new(""))]
|
727
743
|
end_offset = start_offset
|
728
744
|
else
|
729
|
-
expr = parse_script(value,
|
730
|
-
:offset => to_parser_offset(start_offset),
|
731
|
-
:css_variable => name.start_with?("--"))
|
745
|
+
expr = parse_script(value, :offset => to_parser_offset(start_offset))
|
732
746
|
end_offset = expr.source_range.end_pos.offset - 1
|
747
|
+
parsed_value = [expr]
|
733
748
|
end
|
734
|
-
|
735
|
-
node = Tree::PropNode.new(parse_interp(name), expr, prop)
|
749
|
+
node = Tree::PropNode.new(parse_interp(name), parsed_value, prop)
|
736
750
|
node.value_source_range = Sass::Source::Range.new(
|
737
751
|
Sass::Source::Position.new(line.index, to_parser_offset(start_offset)),
|
738
752
|
Sass::Source::Position.new(line.index, to_parser_offset(end_offset)),
|
739
753
|
@options[:filename], @options[:importer])
|
740
|
-
if value.strip.empty? && line.children.empty?
|
754
|
+
if !node.custom_property? && value.strip.empty? && line.children.empty?
|
741
755
|
raise SyntaxError.new(
|
742
756
|
"Invalid property: \"#{node.declaration}\" (no value)." +
|
743
757
|
node.pseudo_class_selector_message)
|
@@ -1154,9 +1168,9 @@ WARNING
|
|
1154
1168
|
end
|
1155
1169
|
|
1156
1170
|
def parse_script(script, options = {})
|
1157
|
-
line = options
|
1158
|
-
offset = options
|
1159
|
-
Script.parse(script, line, offset, @options
|
1171
|
+
line = options[:line] || @line
|
1172
|
+
offset = options[:offset] || @offset + 1
|
1173
|
+
Script.parse(script, line, offset, @options)
|
1160
1174
|
end
|
1161
1175
|
|
1162
1176
|
def format_comment_text(text, silent)
|