haml 3.1.8 → 3.2.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/CONTRIBUTING +1 -1
- data/README.md +2 -2
- data/REVISION +1 -1
- data/Rakefile +16 -41
- data/VERSION +1 -1
- data/VERSION_NAME +1 -1
- data/lib/haml/buffer.rb +1 -5
- data/lib/haml/compiler.rb +7 -8
- data/lib/haml/exec.rb +1 -1
- data/lib/haml/helpers.rb +3 -5
- data/lib/haml/helpers/action_view_mods.rb +5 -21
- data/lib/haml/parser.rb +1 -1
- data/lib/haml/template.rb +1 -3
- data/lib/haml/util.rb +1 -1
- data/test/haml/engine_test.rb +12 -51
- data/test/haml/helper_test.rb +8 -25
- data/test/haml/html2haml_test.rb +1 -1
- data/test/haml/results/whitespace_handling.xhtml +50 -46
- data/test/haml/template_test.rb +2 -28
- data/test/haml/templates/partial_layout.haml +1 -4
- data/test/linked_rails.rb +4 -4
- data/vendor/sass/VERSION +1 -1
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +2 -115
- data/vendor/sass/doc-src/SASS_REFERENCE.md +4 -12
- data/vendor/sass/lib/sass.rb +0 -1
- data/vendor/sass/lib/sass/cache_stores/base.rb +1 -3
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -2
- data/vendor/sass/lib/sass/css.rb +1 -2
- data/vendor/sass/lib/sass/engine.rb +23 -39
- data/vendor/sass/lib/sass/environment.rb +0 -11
- data/vendor/sass/lib/sass/exec.rb +1 -14
- data/vendor/sass/lib/sass/importers/base.rb +1 -2
- data/vendor/sass/lib/sass/importers/filesystem.rb +13 -18
- data/vendor/sass/lib/sass/less.rb +2 -2
- data/vendor/sass/lib/sass/plugin.rb +8 -4
- data/vendor/sass/lib/sass/plugin/compiler.rb +17 -42
- data/vendor/sass/lib/sass/plugin/configuration.rb +2 -0
- data/vendor/sass/lib/sass/railtie.rb +1 -1
- data/vendor/sass/lib/sass/script/funcall.rb +1 -14
- data/vendor/sass/lib/sass/script/functions.rb +1 -44
- data/vendor/sass/lib/sass/script/interpolation.rb +0 -9
- data/vendor/sass/lib/sass/script/lexer.rb +1 -6
- data/vendor/sass/lib/sass/script/list.rb +0 -7
- data/vendor/sass/lib/sass/script/literal.rb +0 -5
- data/vendor/sass/lib/sass/script/node.rb +0 -8
- data/vendor/sass/lib/sass/script/number.rb +5 -28
- data/vendor/sass/lib/sass/script/operation.rb +0 -8
- data/vendor/sass/lib/sass/script/parser.rb +5 -12
- data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -9
- data/vendor/sass/lib/sass/script/unary_operation.rb +0 -7
- data/vendor/sass/lib/sass/script/variable.rb +0 -5
- data/vendor/sass/lib/sass/scss/parser.rb +38 -78
- data/vendor/sass/lib/sass/scss/rx.rb +1 -2
- data/vendor/sass/lib/sass/scss/static_parser.rb +2 -2
- data/vendor/sass/lib/sass/shared.rb +1 -1
- data/vendor/sass/lib/sass/tree/comment_node.rb +11 -24
- data/vendor/sass/lib/sass/tree/debug_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/each_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/extend_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/for_node.rb +2 -2
- data/vendor/sass/lib/sass/tree/function_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/if_node.rb +14 -1
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/mixin_node.rb +2 -2
- data/vendor/sass/lib/sass/tree/node.rb +5 -2
- data/vendor/sass/lib/sass/tree/prop_node.rb +9 -2
- data/vendor/sass/lib/sass/tree/return_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/rule_node.rb +2 -9
- data/vendor/sass/lib/sass/tree/variable_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +18 -17
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +5 -10
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +19 -50
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +15 -9
- data/vendor/sass/lib/sass/tree/warn_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/while_node.rb +1 -1
- data/vendor/sass/lib/sass/util.rb +6 -58
- data/vendor/sass/sass.gemspec +1 -2
- data/vendor/sass/test/sass/cache_test.rb +0 -15
- data/vendor/sass/test/sass/conversion_test.rb +6 -2
- data/vendor/sass/test/sass/css2sass_test.rb +0 -9
- data/vendor/sass/test/sass/engine_test.rb +26 -124
- data/vendor/sass/test/sass/functions_test.rb +0 -13
- data/vendor/sass/test/sass/importer_test.rb +0 -110
- data/vendor/sass/test/sass/plugin_test.rb +13 -16
- data/vendor/sass/test/sass/script_conversion_test.rb +0 -2
- data/vendor/sass/test/sass/script_test.rb +0 -18
- data/vendor/sass/test/sass/scss/css_test.rb +1 -7
- data/vendor/sass/test/sass/scss/scss_test.rb +13 -37
- data/vendor/sass/test/sass/test_helper.rb +1 -1
- data/vendor/sass/test/sass/util_test.rb +0 -12
- data/vendor/sass/vendor/fssm/LICENSE +1 -1
- data/vendor/sass/vendor/fssm/README.markdown +27 -55
- data/vendor/sass/vendor/fssm/Rakefile +54 -6
- data/vendor/sass/vendor/fssm/VERSION.yml +5 -0
- data/vendor/sass/vendor/fssm/example.rb +3 -6
- data/vendor/sass/vendor/fssm/fssm.gemspec +70 -17
- data/vendor/sass/vendor/fssm/lib/fssm.rb +3 -7
- data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +1 -1
- data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +2 -2
- data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +2 -2
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +10 -10
- data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +9 -19
- data/vendor/sass/vendor/fssm/lib/fssm/path.rb +21 -24
- data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +479 -13
- data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +11 -29
- data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +1 -1
- data/vendor/sass/vendor/fssm/lib/fssm/support.rb +12 -41
- data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +6 -6
- data/vendor/sass/vendor/fssm/profile/prof-cache.rb +3 -3
- data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +7 -7
- data/vendor/sass/vendor/fssm/spec/path_spec.rb +15 -36
- data/vendor/sass/vendor/fssm/spec/spec_helper.rb +6 -6
- metadata +78 -125
- data/lib/haml/helpers/rails_323_textarea_fix.rb +0 -41
- data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
- data/test/gemfiles/Gemfile.rails-3.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
- data/test/gemfiles/Gemfile.rails-3.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -97
- data/test/gemfiles/Gemfile.rails-3.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-3.2.x.lock +0 -95
- data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
- data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
- data/vendor/sass/lib/sass/logger.rb +0 -15
- data/vendor/sass/lib/sass/logger/base.rb +0 -32
- data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
- data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
- data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
- data/vendor/sass/test/Gemfile +0 -4
- data/vendor/sass/test/Gemfile.lock +0 -19
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/vendor/sass/test/sass/logger_test.rb +0 -58
- data/vendor/sass/test/sass/templates/bork5.sass +0 -3
- data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
- data/vendor/sass/vendor/fssm/Gemfile +0 -3
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
- data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
- data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
- data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
- data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
@@ -28,8 +28,6 @@ require 'sass/tree/visitors/perform'
|
|
28
28
|
require 'sass/tree/visitors/cssize'
|
29
29
|
require 'sass/tree/visitors/convert'
|
30
30
|
require 'sass/tree/visitors/to_css'
|
31
|
-
require 'sass/tree/visitors/deep_copy'
|
32
|
-
require 'sass/tree/visitors/set_options'
|
33
31
|
require 'sass/tree/visitors/check_nesting'
|
34
32
|
require 'sass/selector'
|
35
33
|
require 'sass/environment'
|
@@ -90,10 +88,7 @@ module Sass
|
|
90
88
|
#
|
91
89
|
# `children`: `Array<Line>`
|
92
90
|
# : The lines nested below this one.
|
93
|
-
|
94
|
-
# `comment_tab_str`: `String?`
|
95
|
-
# : The prefix indentation for this comment, if it is a comment.
|
96
|
-
class Line < Struct.new(:text, :tabs, :index, :offset, :filename, :children, :comment_tab_str)
|
91
|
+
class Line < Struct.new(:text, :tabs, :index, :offset, :filename, :children)
|
97
92
|
def comment?
|
98
93
|
text[0] == COMMENT_CHAR && (text[1] == SASS_COMMENT_CHAR || text[1] == CSS_COMMENT_CHAR)
|
99
94
|
end
|
@@ -110,10 +105,6 @@ module Sass
|
|
110
105
|
# which is not output as a CSS comment.
|
111
106
|
SASS_COMMENT_CHAR = ?/
|
112
107
|
|
113
|
-
# The character that indicates that a comment allows interpolation
|
114
|
-
# and should be preserved even in `:compressed` mode.
|
115
|
-
SASS_LOUD_COMMENT_CHAR = ?!
|
116
|
-
|
117
108
|
# The character that follows the general COMMENT_CHAR and designates a CSS comment,
|
118
109
|
# which is embedded in the CSS document.
|
119
110
|
CSS_COMMENT_CHAR = ?*
|
@@ -316,6 +307,7 @@ module Sass
|
|
316
307
|
sha = Digest::SHA1.hexdigest(@template)
|
317
308
|
|
318
309
|
if root = @options[:cache_store].retrieve(key, sha)
|
310
|
+
@options = root.options.merge(@options)
|
319
311
|
root.options = @options
|
320
312
|
return root
|
321
313
|
end
|
@@ -324,7 +316,7 @@ module Sass
|
|
324
316
|
check_encoding!
|
325
317
|
|
326
318
|
if @options[:syntax] == :scss
|
327
|
-
root = Sass::SCSS::Parser.new(@template
|
319
|
+
root = Sass::SCSS::Parser.new(@template).parse
|
328
320
|
else
|
329
321
|
root = Tree::RootNode.new(@template)
|
330
322
|
append_children(root, tree(tabulate(@template)).first, true)
|
@@ -334,7 +326,7 @@ module Sass
|
|
334
326
|
if @options[:cache] && key && sha
|
335
327
|
begin
|
336
328
|
old_options = root.options
|
337
|
-
root.options = {}
|
329
|
+
root.options = {:importer => root.options[:importer]}
|
338
330
|
@options[:cache_store].store(key, sha, root)
|
339
331
|
ensure
|
340
332
|
root.options = old_options
|
@@ -427,8 +419,7 @@ but this line was indented by #{Sass::Shared.human_indentation line[/^\s*/]}.
|
|
427
419
|
MSG
|
428
420
|
end
|
429
421
|
|
430
|
-
last.
|
431
|
-
last.text << "\n" << line
|
422
|
+
last.text << "\n" << $1
|
432
423
|
true
|
433
424
|
end
|
434
425
|
|
@@ -494,8 +485,8 @@ MSG
|
|
494
485
|
if child.is_a?(Tree::CommentNode) && child.silent
|
495
486
|
if continued_comment &&
|
496
487
|
child.line == continued_comment.line +
|
497
|
-
continued_comment.
|
498
|
-
continued_comment.value
|
488
|
+
continued_comment.value.count("\n") + 1
|
489
|
+
continued_comment.value << "\n" << child.value
|
499
490
|
next
|
500
491
|
end
|
501
492
|
|
@@ -546,7 +537,7 @@ WARNING
|
|
546
537
|
when ?$
|
547
538
|
parse_variable(line)
|
548
539
|
when COMMENT_CHAR
|
549
|
-
parse_comment(line)
|
540
|
+
parse_comment(line.text)
|
550
541
|
when DIRECTIVE_CHAR
|
551
542
|
parse_directive(parent, line, root)
|
552
543
|
when ESCAPE_CHAR
|
@@ -567,7 +558,7 @@ WARNING
|
|
567
558
|
def parse_property_or_rule(line)
|
568
559
|
scanner = StringScanner.new(line.text)
|
569
560
|
hack_char = scanner.scan(/[:\*\.]|\#(?!\{)/)
|
570
|
-
parser = Sass::SCSS::SassParser.new(scanner, @
|
561
|
+
parser = Sass::SCSS::SassParser.new(scanner, @line)
|
571
562
|
|
572
563
|
unless res = parser.parse_interp_ident
|
573
564
|
return Tree::RuleNode.new(parse_interp(line.text))
|
@@ -590,9 +581,15 @@ WARNING
|
|
590
581
|
if value.strip.empty?
|
591
582
|
expr = Sass::Script::String.new("")
|
592
583
|
else
|
584
|
+
important = false
|
585
|
+
if value =~ Sass::SCSS::RX::IMPORTANT
|
586
|
+
important = true
|
587
|
+
value = value.gsub(Sass::SCSS::RX::IMPORTANT,"")
|
588
|
+
end
|
593
589
|
expr = parse_script(value, :offset => line.offset + line.text.index(value))
|
590
|
+
|
594
591
|
end
|
595
|
-
Tree::PropNode.new(parse_interp(name), expr, prop)
|
592
|
+
Tree::PropNode.new(parse_interp(name), expr, important, prop)
|
596
593
|
end
|
597
594
|
|
598
595
|
def parse_variable(line)
|
@@ -608,19 +605,11 @@ WARNING
|
|
608
605
|
end
|
609
606
|
|
610
607
|
def parse_comment(line)
|
611
|
-
if line
|
612
|
-
silent = line
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
else
|
617
|
-
value = [line.text]
|
618
|
-
end
|
619
|
-
value = with_extracted_values(value) do |str|
|
620
|
-
str = str.gsub(/^#{line.comment_tab_str}/m, '')[2..-1] # get rid of // or /*
|
621
|
-
format_comment_text(str, silent)
|
622
|
-
end
|
623
|
-
Tree::CommentNode.new(value, silent, loud)
|
608
|
+
if line[1] == CSS_COMMENT_CHAR || line[1] == SASS_COMMENT_CHAR
|
609
|
+
silent = line[1] == SASS_COMMENT_CHAR
|
610
|
+
Tree::CommentNode.new(
|
611
|
+
format_comment_text(line[2..-1], silent),
|
612
|
+
silent)
|
624
613
|
else
|
625
614
|
Tree::RuleNode.new(parse_interp(line))
|
626
615
|
end
|
@@ -761,11 +750,6 @@ WARNING
|
|
761
750
|
break unless scanner.scan(/,\s*/)
|
762
751
|
end
|
763
752
|
|
764
|
-
if scanner.scan(/;/)
|
765
|
-
raise SyntaxError.new("Invalid @import: expected end of line, was \";\".",
|
766
|
-
:line => @line)
|
767
|
-
end
|
768
|
-
|
769
753
|
return values
|
770
754
|
end
|
771
755
|
|
@@ -773,12 +757,12 @@ WARNING
|
|
773
757
|
return if scanner.eos?
|
774
758
|
unless (str = scanner.scan(Sass::SCSS::RX::STRING)) ||
|
775
759
|
(uri = scanner.scan(Sass::SCSS::RX::URI))
|
776
|
-
return Tree::ImportNode.new(scanner.scan(/[
|
760
|
+
return Tree::ImportNode.new(scanner.scan(/[^,]+/))
|
777
761
|
end
|
778
762
|
|
779
763
|
val = scanner[1] || scanner[2]
|
780
764
|
scanner.scan(/\s*/)
|
781
|
-
if media = scanner.scan(/[
|
765
|
+
if media = scanner.scan(/[^,].*/)
|
782
766
|
Tree::DirectiveNode.new("@import #{str || uri} #{media}")
|
783
767
|
elsif uri
|
784
768
|
Tree::DirectiveNode.new("@import #{uri}")
|
@@ -93,17 +93,6 @@ module Sass
|
|
93
93
|
@mixins_in_use ||= @parent.mixins_in_use
|
94
94
|
end
|
95
95
|
|
96
|
-
def stack_trace
|
97
|
-
trace = []
|
98
|
-
stack.reverse.each_with_index do |entry, i|
|
99
|
-
msg = "#{i == 0 ? "on" : "from"} line #{entry[:line]}"
|
100
|
-
msg << " of #{entry[:filename] || "an unknown file"}"
|
101
|
-
msg << ", in `#{entry[:mixin]}'" if entry[:mixin]
|
102
|
-
trace << msg
|
103
|
-
end
|
104
|
-
trace
|
105
|
-
end
|
106
|
-
|
107
96
|
private
|
108
97
|
|
109
98
|
def parent_options
|
@@ -229,10 +229,6 @@ END
|
|
229
229
|
'Only meaningful for --watch and --update.') do
|
230
230
|
@options[:stop_on_error] = true
|
231
231
|
end
|
232
|
-
opts.on('-f', '--force', 'Recompile all Sass files, even if the CSS file is newer.',
|
233
|
-
'Only meaningful for --update.') do
|
234
|
-
@options[:force] = true
|
235
|
-
end
|
236
232
|
opts.on('-c', '--check', "Just check syntax, don't evaluate.") do
|
237
233
|
require 'stringio'
|
238
234
|
@options[:check_syntax] = true
|
@@ -242,10 +238,6 @@ END
|
|
242
238
|
'Output style. Can be nested (default), compact, compressed, or expanded.') do |name|
|
243
239
|
@options[:for_engine][:style] = name.to_sym
|
244
240
|
end
|
245
|
-
opts.on('--precision NUMBER_OF_DIGITS', Integer,
|
246
|
-
'How many digits of precision to use when outputting decimal numbers. Defaults to 3.') do |precision|
|
247
|
-
::Sass::Script::Number.precision = precision
|
248
|
-
end
|
249
241
|
opts.on('-q', '--quiet', 'Silence warnings and status messages during compilation.') do
|
250
242
|
@options[:for_engine][:quiet] = true
|
251
243
|
end
|
@@ -358,11 +350,6 @@ END
|
|
358
350
|
::Sass::Plugin.options.merge! @options[:for_engine]
|
359
351
|
::Sass::Plugin.options[:unix_newlines] = @options[:unix_newlines]
|
360
352
|
|
361
|
-
if @options[:force]
|
362
|
-
raise "The --force flag may only be used with --update." unless @options[:update]
|
363
|
-
::Sass::Plugin.options[:always_update] = true
|
364
|
-
end
|
365
|
-
|
366
353
|
raise <<MSG if @args.empty?
|
367
354
|
What files should I watch? Did you mean something like:
|
368
355
|
#{@default_syntax} --watch input.#{@default_syntax}:output.css
|
@@ -385,7 +372,7 @@ MSG
|
|
385
372
|
|
386
373
|
dirs, files = @args.map {|name| split_colon_path(name)}.
|
387
374
|
partition {|i, _| File.directory? i}
|
388
|
-
files.map! {|from, to| [from, to || from.gsub(
|
375
|
+
files.map! {|from, to| [from, to || from.gsub(/\..*?$/, '.css')]}
|
389
376
|
dirs.map! {|from, to| [from, to || from]}
|
390
377
|
::Sass::Plugin.options[:template_location] = dirs
|
391
378
|
|
@@ -72,8 +72,7 @@ module Sass
|
|
72
72
|
# If no such files exist, it should return nil.
|
73
73
|
#
|
74
74
|
# The {Sass::Engine} to be returned should be passed `options`,
|
75
|
-
# with a few modifications. `:syntax` should be set appropriately,
|
76
|
-
# `:filename` should be set to `uri`,
|
75
|
+
# with a few modifications. `:filename` and `:syntax` should be set appropriately,
|
77
76
|
# and `:importer` should be set to this importer.
|
78
77
|
#
|
79
78
|
# @param uri [String] The URI to import.
|
@@ -13,7 +13,7 @@ module Sass
|
|
13
13
|
# @param root [String] The root path.
|
14
14
|
# This importer will import files relative to this path.
|
15
15
|
def initialize(root)
|
16
|
-
@root =
|
16
|
+
@root = root
|
17
17
|
end
|
18
18
|
|
19
19
|
# @see Base#find_relative
|
@@ -45,21 +45,14 @@ module Sass
|
|
45
45
|
@root
|
46
46
|
end
|
47
47
|
|
48
|
-
def hash
|
49
|
-
@root.hash
|
50
|
-
end
|
51
|
-
|
52
|
-
def eql?(other)
|
53
|
-
root.eql?(other.root)
|
54
|
-
end
|
55
|
-
|
56
48
|
protected
|
57
49
|
|
58
50
|
# If a full uri is passed, this removes the root from it
|
59
51
|
# otherwise returns the name unchanged
|
60
52
|
def remove_root(name)
|
61
|
-
|
62
|
-
|
53
|
+
root = @root.end_with?('/') ? @root : @root + '/'
|
54
|
+
if name.index(root) == 0
|
55
|
+
name[root.length..-1]
|
63
56
|
else
|
64
57
|
name
|
65
58
|
end
|
@@ -84,7 +77,6 @@ module Sass
|
|
84
77
|
# The first element of each pair is a filename to look for;
|
85
78
|
# the second element is the syntax that file would be in (`:sass` or `:scss`).
|
86
79
|
def possible_files(name)
|
87
|
-
name = escape_glob_characters(name)
|
88
80
|
dirname, basename, extname = split(name)
|
89
81
|
sorted_exts = extensions.sort
|
90
82
|
syntax = extensions[extname]
|
@@ -93,11 +85,6 @@ module Sass
|
|
93
85
|
sorted_exts.map {|ext, syn| ["#{dirname}/{_,}#{basename}.#{ext}", syn]}
|
94
86
|
end
|
95
87
|
|
96
|
-
def escape_glob_characters(name)
|
97
|
-
name.gsub(/[\*\[\]\{\}\?]/) do |char|
|
98
|
-
"\\#{char}"
|
99
|
-
end
|
100
|
-
end
|
101
88
|
|
102
89
|
REDUNDANT_DIRECTORY = %r{#{Regexp.escape(File::SEPARATOR)}\.#{Regexp.escape(File::SEPARATOR)}}
|
103
90
|
# Given a base directory and an `@import`ed name,
|
@@ -108,7 +95,7 @@ module Sass
|
|
108
95
|
# @return [(String, Symbol)] A filename-syntax pair.
|
109
96
|
def find_real_file(dir, name)
|
110
97
|
for (f,s) in possible_files(remove_root(name))
|
111
|
-
path = (dir == "."
|
98
|
+
path = (dir == ".") ? f : "#{dir}/#{f}"
|
112
99
|
if full_path = Dir[path].first
|
113
100
|
full_path.gsub!(REDUNDANT_DIRECTORY,File::SEPARATOR)
|
114
101
|
return full_path, s
|
@@ -129,6 +116,14 @@ module Sass
|
|
129
116
|
[dirname, basename, extension]
|
130
117
|
end
|
131
118
|
|
119
|
+
def hash
|
120
|
+
@root.hash
|
121
|
+
end
|
122
|
+
|
123
|
+
def eql?(other)
|
124
|
+
root.eql?(other.root)
|
125
|
+
end
|
126
|
+
|
132
127
|
private
|
133
128
|
|
134
129
|
def _find(dir, name, options)
|
@@ -31,7 +31,7 @@ module Less
|
|
31
31
|
WARNING: Sass doesn't support mixing in selector sequences.
|
32
32
|
Replacing "#{sel}" with "@extend #{base}"
|
33
33
|
WARNING
|
34
|
-
env << Node::SassNode.new(Sass::Tree::CommentNode.new(
|
34
|
+
env << Node::SassNode.new(Sass::Tree::CommentNode.new("// #{sel};", true))
|
35
35
|
env << Node::SassNode.new(Sass::Tree::ExtendNode.new([base]))
|
36
36
|
end
|
37
37
|
end
|
@@ -225,7 +225,7 @@ WARNING
|
|
225
225
|
class Property
|
226
226
|
def to_sass_tree
|
227
227
|
return if hide_in_sass
|
228
|
-
Sass::Tree::PropNode.new([self], @value.to_sass_tree, :new)
|
228
|
+
Sass::Tree::PropNode.new([self], @value.to_sass_tree, false, :new)
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
@@ -92,10 +92,14 @@ module Sass
|
|
92
92
|
# the second is the location of the CSS file that it should be compiled to.
|
93
93
|
# @see #update_stylesheets
|
94
94
|
def force_update_stylesheets(individual_files = [])
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
95
|
+
old_options = options
|
96
|
+
self.options = options.dup
|
97
|
+
options[:never_update] = false
|
98
|
+
options[:always_update] = true
|
99
|
+
options[:cache] = false
|
100
|
+
update_stylesheets(individual_files)
|
101
|
+
ensure
|
102
|
+
self.options = old_options
|
99
103
|
end
|
100
104
|
|
101
105
|
# All other method invocations are proxied to the \{#compiler}.
|
@@ -38,7 +38,7 @@ module Sass::Plugin
|
|
38
38
|
self.options.merge!(options)
|
39
39
|
end
|
40
40
|
|
41
|
-
# Register a callback to be run
|
41
|
+
# Register a callback to be run before stylesheets are mass-updated.
|
42
42
|
# This is run whenever \{#update\_stylesheets} is called,
|
43
43
|
# unless the \{file:SASS_REFERENCE.md#never_update-option `:never_update` option}
|
44
44
|
# is enabled.
|
@@ -51,22 +51,6 @@ module Sass::Plugin
|
|
51
51
|
# the second is the target CSS file.
|
52
52
|
define_callback :updating_stylesheets
|
53
53
|
|
54
|
-
# Register a callback to be run after a single stylesheet is updated.
|
55
|
-
# The callback is only run if the stylesheet is really updated;
|
56
|
-
# if the CSS file is fresh, this won't be run.
|
57
|
-
#
|
58
|
-
# Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
|
59
|
-
# is enabled, this callback won't be run
|
60
|
-
# when an exception CSS file is being written.
|
61
|
-
# To run an action for those files, use \{#on\_compilation\_error}.
|
62
|
-
#
|
63
|
-
# @yield [template, css]
|
64
|
-
# @yieldparam template [String]
|
65
|
-
# The location of the Sass/SCSS file being updated.
|
66
|
-
# @yieldparam css [String]
|
67
|
-
# The location of the CSS file being generated.
|
68
|
-
define_callback :updated_stylesheet
|
69
|
-
|
70
54
|
# Register a callback to be run before a single stylesheet is updated.
|
71
55
|
# The callback is only run if the stylesheet is guaranteed to be updated;
|
72
56
|
# if the CSS file is fresh, this won't be run.
|
@@ -83,13 +67,6 @@ module Sass::Plugin
|
|
83
67
|
# The location of the CSS file being generated.
|
84
68
|
define_callback :updating_stylesheet
|
85
69
|
|
86
|
-
def on_updating_stylesheet_with_deprecation_warning(&block)
|
87
|
-
Sass::Util.sass_warn("Sass::Compiler#on_updating_stylesheet callback is deprecated and will be removed in a future release. Use Sass::Compiler#on_updated_stylesheet instead, which is run after stylesheet compilation.")
|
88
|
-
on_updating_stylesheet_without_deprecation_warning(&block)
|
89
|
-
end
|
90
|
-
alias_method :on_updating_stylesheet_without_deprecation_warning, :on_updating_stylesheet
|
91
|
-
alias_method :on_updating_stylesheet, :on_updating_stylesheet_with_deprecation_warning
|
92
|
-
|
93
70
|
# Register a callback to be run when Sass decides not to update a stylesheet.
|
94
71
|
# In particular, the callback is run when Sass finds that
|
95
72
|
# the template file and none of its dependencies
|
@@ -183,25 +160,28 @@ module Sass::Plugin
|
|
183
160
|
# The first string in each pair is the location of the Sass/SCSS file,
|
184
161
|
# the second is the location of the CSS file that it should be compiled to.
|
185
162
|
def update_stylesheets(individual_files = [])
|
163
|
+
run_updating_stylesheets individual_files
|
186
164
|
Sass::Plugin.checked_for_updates = true
|
187
165
|
staleness_checker = StalenessChecker.new(engine_options)
|
188
166
|
|
167
|
+
individual_files.each do |t, c|
|
168
|
+
if options[:always_update] || staleness_checker.stylesheet_needs_update?(c, t)
|
169
|
+
update_stylesheet(t, c)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
189
173
|
template_location_array.each do |template_location, css_location|
|
174
|
+
|
190
175
|
Dir.glob(File.join(template_location, "**", "[^_]*.s[ca]ss")).sort.each do |file|
|
191
176
|
# Get the relative path to the file
|
192
177
|
name = file.sub(template_location.to_s.sub(/\/*$/, '/'), "")
|
193
178
|
css = css_filename(name, css_location)
|
194
|
-
individual_files << [file, css]
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
run_updating_stylesheets individual_files
|
199
179
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
180
|
+
if options[:always_update] || staleness_checker.stylesheet_needs_update?(css, file)
|
181
|
+
update_stylesheet file, css
|
182
|
+
else
|
183
|
+
run_not_updating_stylesheet file, css
|
184
|
+
end
|
205
185
|
end
|
206
186
|
end
|
207
187
|
end
|
@@ -338,23 +318,18 @@ module Sass::Plugin
|
|
338
318
|
engine_opts = engine_options(:css_filename => css, :filename => filename)
|
339
319
|
result = Sass::Engine.for_file(filename, engine_opts).render
|
340
320
|
rescue Exception => e
|
341
|
-
compilation_error_occured = true
|
342
321
|
run_compilation_error e, filename, css
|
343
322
|
result = Sass::SyntaxError.exception_to_css(e, options)
|
344
323
|
else
|
345
324
|
run_updating_stylesheet filename, css
|
346
325
|
end
|
347
326
|
|
348
|
-
|
349
|
-
run_updated_stylesheet(filename, css) unless compilation_error_occured
|
350
|
-
end
|
351
|
-
|
352
|
-
def write_file(css, content)
|
327
|
+
# Finally, write the file
|
353
328
|
flag = 'w'
|
354
329
|
flag = 'wb' if Sass::Util.windows? && options[:unix_newlines]
|
355
330
|
File.open(css, flag) do |file|
|
356
|
-
file.set_encoding(
|
357
|
-
file.print(
|
331
|
+
file.set_encoding(result.encoding) unless Sass::Util.ruby1_8?
|
332
|
+
file.print(result)
|
358
333
|
end
|
359
334
|
end
|
360
335
|
|