sass 3.2.19 → 3.4.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -1
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/CONTRIBUTING.md +148 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +87 -61
  7. data/Rakefile +119 -15
  8. data/VERSION +1 -1
  9. data/VERSION_DATE +1 -1
  10. data/VERSION_NAME +1 -1
  11. data/bin/sass +1 -1
  12. data/bin/scss +1 -1
  13. data/extra/sass-spec-ref.sh +32 -0
  14. data/extra/update_watch.rb +1 -1
  15. data/lib/sass/cache_stores/base.rb +2 -2
  16. data/lib/sass/cache_stores/chain.rb +2 -1
  17. data/lib/sass/cache_stores/filesystem.rb +8 -12
  18. data/lib/sass/cache_stores/memory.rb +5 -6
  19. data/lib/sass/cache_stores/null.rb +2 -2
  20. data/lib/sass/callbacks.rb +3 -2
  21. data/lib/sass/css.rb +22 -23
  22. data/lib/sass/deprecation.rb +55 -0
  23. data/lib/sass/engine.rb +487 -191
  24. data/lib/sass/environment.rb +172 -58
  25. data/lib/sass/error.rb +21 -24
  26. data/lib/sass/exec/base.rb +199 -0
  27. data/lib/sass/exec/sass_convert.rb +283 -0
  28. data/lib/sass/exec/sass_scss.rb +440 -0
  29. data/lib/sass/exec.rb +5 -703
  30. data/lib/sass/features.rb +47 -0
  31. data/lib/sass/importers/base.rb +50 -7
  32. data/lib/sass/importers/deprecated_path.rb +51 -0
  33. data/lib/sass/importers/filesystem.rb +54 -21
  34. data/lib/sass/importers.rb +1 -0
  35. data/lib/sass/logger/base.rb +9 -5
  36. data/lib/sass/logger/delayed.rb +50 -0
  37. data/lib/sass/logger/log_level.rb +3 -7
  38. data/lib/sass/logger.rb +9 -7
  39. data/lib/sass/media.rb +20 -23
  40. data/lib/sass/plugin/compiler.rb +321 -145
  41. data/lib/sass/plugin/configuration.rb +45 -34
  42. data/lib/sass/plugin/merb.rb +3 -3
  43. data/lib/sass/plugin/rack.rb +3 -3
  44. data/lib/sass/plugin/rails.rb +1 -1
  45. data/lib/sass/plugin/staleness_checker.rb +6 -6
  46. data/lib/sass/plugin.rb +9 -8
  47. data/lib/sass/repl.rb +3 -3
  48. data/lib/sass/script/css_lexer.rb +8 -4
  49. data/lib/sass/script/css_parser.rb +4 -2
  50. data/lib/sass/script/css_variable_warning.rb +52 -0
  51. data/lib/sass/script/functions.rb +1583 -433
  52. data/lib/sass/script/lexer.rb +198 -79
  53. data/lib/sass/script/parser.rb +463 -133
  54. data/lib/sass/script/tree/funcall.rb +313 -0
  55. data/lib/sass/script/tree/interpolation.rb +223 -0
  56. data/lib/sass/script/tree/list_literal.rb +104 -0
  57. data/lib/sass/script/tree/literal.rb +49 -0
  58. data/lib/sass/script/tree/map_literal.rb +64 -0
  59. data/lib/sass/script/{node.rb → tree/node.rb} +42 -14
  60. data/lib/sass/script/tree/operation.rb +156 -0
  61. data/lib/sass/script/tree/selector.rb +26 -0
  62. data/lib/sass/script/tree/string_interpolation.rb +125 -0
  63. data/lib/sass/script/{unary_operation.rb → tree/unary_operation.rb} +6 -6
  64. data/lib/sass/script/tree/variable.rb +57 -0
  65. data/lib/sass/script/tree.rb +16 -0
  66. data/lib/sass/script/{arg_list.rb → value/arg_list.rb} +9 -25
  67. data/lib/sass/script/value/base.rb +241 -0
  68. data/lib/sass/script/value/bool.rb +35 -0
  69. data/lib/sass/script/value/color.rb +698 -0
  70. data/lib/sass/script/value/helpers.rb +272 -0
  71. data/lib/sass/script/value/list.rb +113 -0
  72. data/lib/sass/script/value/map.rb +70 -0
  73. data/lib/sass/script/{null.rb → value/null.rb} +14 -7
  74. data/lib/sass/script/{number.rb → value/number.rb} +196 -86
  75. data/lib/sass/script/value/string.rb +138 -0
  76. data/lib/sass/script/value.rb +11 -0
  77. data/lib/sass/script.rb +38 -11
  78. data/lib/sass/scss/css_parser.rb +25 -5
  79. data/lib/sass/scss/parser.rb +532 -458
  80. data/lib/sass/scss/rx.rb +21 -14
  81. data/lib/sass/scss/static_parser.rb +328 -9
  82. data/lib/sass/scss.rb +0 -2
  83. data/lib/sass/selector/abstract_sequence.rb +36 -19
  84. data/lib/sass/selector/comma_sequence.rb +125 -26
  85. data/lib/sass/selector/pseudo.rb +266 -0
  86. data/lib/sass/selector/sequence.rb +200 -71
  87. data/lib/sass/selector/simple.rb +30 -32
  88. data/lib/sass/selector/simple_sequence.rb +193 -64
  89. data/lib/sass/selector.rb +65 -194
  90. data/lib/sass/shared.rb +2 -2
  91. data/lib/sass/source/map.rb +213 -0
  92. data/lib/sass/source/position.rb +39 -0
  93. data/lib/sass/source/range.rb +41 -0
  94. data/lib/sass/stack.rb +120 -0
  95. data/lib/sass/supports.rb +19 -23
  96. data/lib/sass/tree/at_root_node.rb +83 -0
  97. data/lib/sass/tree/charset_node.rb +1 -1
  98. data/lib/sass/tree/comment_node.rb +4 -4
  99. data/lib/sass/tree/css_import_node.rb +19 -11
  100. data/lib/sass/tree/debug_node.rb +2 -2
  101. data/lib/sass/tree/directive_node.rb +21 -4
  102. data/lib/sass/tree/each_node.rb +8 -8
  103. data/lib/sass/tree/error_node.rb +18 -0
  104. data/lib/sass/tree/extend_node.rb +14 -7
  105. data/lib/sass/tree/for_node.rb +4 -4
  106. data/lib/sass/tree/function_node.rb +14 -4
  107. data/lib/sass/tree/if_node.rb +1 -1
  108. data/lib/sass/tree/import_node.rb +10 -10
  109. data/lib/sass/tree/keyframe_rule_node.rb +15 -0
  110. data/lib/sass/tree/media_node.rb +4 -14
  111. data/lib/sass/tree/mixin_def_node.rb +4 -4
  112. data/lib/sass/tree/mixin_node.rb +21 -8
  113. data/lib/sass/tree/node.rb +59 -15
  114. data/lib/sass/tree/prop_node.rb +42 -24
  115. data/lib/sass/tree/return_node.rb +3 -2
  116. data/lib/sass/tree/root_node.rb +19 -3
  117. data/lib/sass/tree/rule_node.rb +49 -26
  118. data/lib/sass/tree/supports_node.rb +0 -13
  119. data/lib/sass/tree/trace_node.rb +2 -1
  120. data/lib/sass/tree/variable_node.rb +9 -3
  121. data/lib/sass/tree/visitors/base.rb +5 -8
  122. data/lib/sass/tree/visitors/check_nesting.rb +62 -36
  123. data/lib/sass/tree/visitors/convert.rb +111 -76
  124. data/lib/sass/tree/visitors/cssize.rb +206 -74
  125. data/lib/sass/tree/visitors/deep_copy.rb +11 -6
  126. data/lib/sass/tree/visitors/extend.rb +19 -17
  127. data/lib/sass/tree/visitors/perform.rb +308 -190
  128. data/lib/sass/tree/visitors/set_options.rb +21 -7
  129. data/lib/sass/tree/visitors/to_css.rb +273 -92
  130. data/lib/sass/tree/warn_node.rb +2 -2
  131. data/lib/sass/tree/while_node.rb +2 -2
  132. data/lib/sass/util/cross_platform_random.rb +19 -0
  133. data/lib/sass/util/normalized_map.rb +129 -0
  134. data/lib/sass/util/ordered_hash.rb +192 -0
  135. data/lib/sass/util/subset_map.rb +5 -5
  136. data/lib/sass/util/test.rb +0 -1
  137. data/lib/sass/util.rb +620 -193
  138. data/lib/sass/version.rb +22 -24
  139. data/lib/sass.rb +27 -13
  140. data/test/sass/cache_test.rb +62 -20
  141. data/test/sass/callbacks_test.rb +1 -1
  142. data/test/sass/compiler_test.rb +236 -0
  143. data/test/sass/conversion_test.rb +472 -44
  144. data/test/sass/css2sass_test.rb +73 -5
  145. data/test/sass/css_variable_test.rb +132 -0
  146. data/test/sass/encoding_test.rb +219 -0
  147. data/test/sass/engine_test.rb +618 -415
  148. data/test/sass/exec_test.rb +12 -2
  149. data/test/sass/extend_test.rb +419 -168
  150. data/test/sass/functions_test.rb +931 -93
  151. data/test/sass/importer_test.rb +250 -21
  152. data/test/sass/logger_test.rb +1 -1
  153. data/test/sass/more_results/more_import.css +1 -1
  154. data/test/sass/more_templates/more1.sass +10 -10
  155. data/test/sass/more_templates/more_import.sass +2 -2
  156. data/test/sass/plugin_test.rb +26 -34
  157. data/test/sass/results/compact.css +1 -1
  158. data/test/sass/results/complex.css +4 -4
  159. data/test/sass/results/expanded.css +1 -1
  160. data/test/sass/results/import.css +1 -1
  161. data/test/sass/results/import_charset_ibm866.css +2 -2
  162. data/test/sass/results/mixins.css +17 -17
  163. data/test/sass/results/nested.css +1 -1
  164. data/test/sass/results/parent_ref.css +2 -2
  165. data/test/sass/results/script.css +5 -5
  166. data/test/sass/results/scss_import.css +1 -1
  167. data/test/sass/script_conversion_test.rb +97 -39
  168. data/test/sass/script_test.rb +911 -102
  169. data/test/sass/scss/css_test.rb +215 -34
  170. data/test/sass/scss/rx_test.rb +8 -4
  171. data/test/sass/scss/scss_test.rb +2424 -325
  172. data/test/sass/source_map_test.rb +1055 -0
  173. data/test/sass/superselector_test.rb +210 -0
  174. data/test/sass/templates/_partial.sass +1 -1
  175. data/test/sass/templates/basic.sass +10 -10
  176. data/test/sass/templates/bork1.sass +1 -1
  177. data/test/sass/templates/bork5.sass +1 -1
  178. data/test/sass/templates/compact.sass +10 -10
  179. data/test/sass/templates/complex.sass +187 -187
  180. data/test/sass/templates/compressed.sass +10 -10
  181. data/test/sass/templates/expanded.sass +10 -10
  182. data/test/sass/templates/import.sass +2 -2
  183. data/test/sass/templates/importee.sass +3 -3
  184. data/test/sass/templates/mixins.sass +22 -22
  185. data/test/sass/templates/multiline.sass +4 -4
  186. data/test/sass/templates/nested.sass +13 -13
  187. data/test/sass/templates/parent_ref.sass +12 -12
  188. data/test/sass/templates/script.sass +70 -70
  189. data/test/sass/templates/scss_import.scss +2 -1
  190. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  191. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  192. data/test/sass/templates/subdir/subdir.sass +3 -3
  193. data/test/sass/templates/units.sass +10 -10
  194. data/test/sass/test_helper.rb +1 -1
  195. data/test/sass/util/multibyte_string_scanner_test.rb +11 -3
  196. data/test/sass/util/normalized_map_test.rb +51 -0
  197. data/test/sass/util/subset_map_test.rb +2 -2
  198. data/test/sass/util_test.rb +99 -43
  199. data/test/sass/value_helpers_test.rb +179 -0
  200. data/test/sass-spec.yml +3 -0
  201. data/test/test_helper.rb +42 -12
  202. data/vendor/listen/CHANGELOG.md +1 -228
  203. data/vendor/listen/Gemfile +5 -15
  204. data/vendor/listen/README.md +111 -77
  205. data/vendor/listen/Rakefile +0 -42
  206. data/vendor/listen/lib/listen/adapter.rb +195 -82
  207. data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
  208. data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
  209. data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
  210. data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
  211. data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
  212. data/vendor/listen/lib/listen/directory_record.rb +96 -61
  213. data/vendor/listen/lib/listen/listener.rb +135 -37
  214. data/vendor/listen/lib/listen/turnstile.rb +9 -5
  215. data/vendor/listen/lib/listen/version.rb +1 -1
  216. data/vendor/listen/lib/listen.rb +33 -19
  217. data/vendor/listen/listen.gemspec +6 -0
  218. data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
  219. data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
  220. data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
  221. data/vendor/listen/spec/listen/listener_spec.rb +128 -39
  222. data/vendor/listen/spec/listen_spec.rb +15 -21
  223. data/vendor/listen/spec/spec_helper.rb +4 -0
  224. data/vendor/listen/spec/support/adapter_helper.rb +52 -15
  225. data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
  226. data/vendor/listen/spec/support/listeners_helper.rb +30 -7
  227. metadata +161 -111
  228. data/CONTRIBUTING +0 -3
  229. data/lib/sass/script/bool.rb +0 -18
  230. data/lib/sass/script/color.rb +0 -606
  231. data/lib/sass/script/funcall.rb +0 -245
  232. data/lib/sass/script/interpolation.rb +0 -79
  233. data/lib/sass/script/list.rb +0 -85
  234. data/lib/sass/script/literal.rb +0 -221
  235. data/lib/sass/script/operation.rb +0 -110
  236. data/lib/sass/script/string.rb +0 -51
  237. data/lib/sass/script/string_interpolation.rb +0 -103
  238. data/lib/sass/script/variable.rb +0 -58
  239. data/lib/sass/scss/script_lexer.rb +0 -15
  240. data/lib/sass/scss/script_parser.rb +0 -25
  241. data/test/Gemfile +0 -3
  242. data/test/Gemfile.lock +0 -10
  243. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  244. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  245. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  246. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
@@ -1,11 +1,11 @@
1
- # We keep configuration in its own self-contained file
2
- # so that we can load it independently in Rails 3,
3
- # where the full plugin stuff is lazy-loaded.
4
-
5
1
  module Sass
6
2
  module Plugin
3
+ # We keep configuration in its own self-contained file so that we can load
4
+ # it independently in Rails 3, where the full plugin stuff is lazy-loaded.
5
+ #
6
+ # Note that this is not guaranteed to be thread-safe. For guaranteed thread
7
+ # safety, use a separate {Sass::Plugin} for each thread.
7
8
  module Configuration
8
-
9
9
  # Returns the default options for a {Sass::Plugin::Compiler}.
10
10
  #
11
11
  # @return [{Symbol => Object}]
@@ -19,36 +19,27 @@ module Sass
19
19
  }.freeze
20
20
  end
21
21
 
22
- # Resets the options and {Sass::Callbacks::InstanceMethods#clear_callbacks! clears all callbacks}.
22
+ # Resets the options and
23
+ # {Sass::Callbacks::InstanceMethods#clear_callbacks! clears all callbacks}.
23
24
  def reset!
24
25
  @options = nil
25
26
  clear_callbacks!
26
27
  end
27
28
 
28
29
  # An options hash.
29
- # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
30
+ # See {file:SASS_REFERENCE.md#Options the Sass options documentation}.
30
31
  #
31
32
  # @return [{Symbol => Object}]
32
33
  def options
33
34
  @options ||= default_options.dup
34
35
  end
35
36
 
36
- # Sets the options hash.
37
- # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
38
- # See {Sass::Plugin::Configuration#reset!}
39
- # @deprecated Instead, modify the options hash in-place.
40
- # @param value [{Symbol => Object}] The options hash
41
- def options=(value)
42
- Sass::Util.sass_warn("Setting Sass::Plugin.options is deprecated " +
43
- "and will be removed in a future release.")
44
- options.merge!(value)
45
- end
46
-
47
37
  # Adds a new template-location/css-location mapping.
48
38
  # This means that Sass/SCSS files in `template_location`
49
39
  # will be compiled to CSS files in `css_location`.
50
40
  #
51
- # This is preferred over manually manipulating the {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
41
+ # This is preferred over manually manipulating the
42
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
52
43
  # since the option can be in multiple formats.
53
44
  #
54
45
  # Note that this method will change `options[:template_location]`
@@ -68,7 +59,8 @@ module Sass
68
59
  # This means that Sass/SCSS files in `template_location`
69
60
  # will no longer be compiled to CSS files in `css_location`.
70
61
  #
71
- # This is preferred over manually manipulating the {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
62
+ # This is preferred over manually manipulating the
63
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
72
64
  # since the option can be in multiple formats.
73
65
  #
74
66
  # Note that this method will change `options[:template_location]`
@@ -95,28 +87,47 @@ module Sass
95
87
  # See the {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
96
88
  # for details.
97
89
  #
90
+ # Modifications to the returned array may not be persistent. Use {#add_template_location}
91
+ # and {#remove_template_location} instead.
92
+ #
98
93
  # @return [Array<(String, String)>]
99
94
  # An array of `[template_location, css_location]` pairs.
100
95
  def template_location_array
101
- old_template_location = options[:template_location]
102
- normalize_template_location!
103
- options[:template_location]
104
- ensure
105
- options[:template_location] = old_template_location
96
+ convert_template_location(options[:template_location], options[:css_location])
106
97
  end
107
98
 
108
99
  private
109
100
 
110
- def normalize_template_location!
111
- return if options[:template_location].is_a?(Array)
112
- options[:template_location] =
113
- case options[:template_location]
114
- when nil
115
- options[:css_location] ?
116
- [[File.join(options[:css_location], 'sass'), options[:css_location]]] : []
117
- when String; [[options[:template_location], options[:css_location]]]
118
- else; options[:template_location].to_a
101
+ # Returns the given template location, as an array. If it's already an array,
102
+ # it is returned unmodified. Otherwise, a new array is created and returned.
103
+ #
104
+ # @param template_location [String, Array<(String, String)>]
105
+ # A single template location, or a pre-normalized array of template
106
+ # locations and CSS locations.
107
+ # @param css_location [String?]
108
+ # The location for compiled CSS files.
109
+ # @return [Array<(String, String)>]
110
+ # An array of `[template_location, css_location]` pairs.
111
+ def convert_template_location(template_location, css_location)
112
+ return template_location if template_location.is_a?(Array)
113
+
114
+ case template_location
115
+ when nil
116
+ if css_location
117
+ [[File.join(css_location, 'sass'), css_location]]
118
+ else
119
+ []
119
120
  end
121
+ when String
122
+ [[template_location, css_location]]
123
+ else
124
+ template_location.to_a
125
+ end
126
+ end
127
+
128
+ def normalize_template_location!
129
+ options[:template_location] = convert_template_location(
130
+ options[:template_location], options[:css_location])
120
131
  end
121
132
  end
122
133
  end
@@ -2,10 +2,10 @@ unless defined?(Sass::MERB_LOADED)
2
2
  Sass::MERB_LOADED = true
3
3
 
4
4
  module Sass::Plugin::Configuration
5
- # Different default options in a m envirionment.
5
+ # Different default options in a m environment.
6
6
  def default_options
7
7
  @default_options ||= begin
8
- version = Merb::VERSION.split('.').map { |n| n.to_i }
8
+ version = Merb::VERSION.split('.').map {|n| n.to_i}
9
9
  if version[0] <= 0 && version[1] < 5
10
10
  root = MERB_ROOT
11
11
  env = MERB_ENV
@@ -15,7 +15,7 @@ unless defined?(Sass::MERB_LOADED)
15
15
  end
16
16
 
17
17
  {
18
- :always_update => false,
18
+ :always_update => false,
19
19
  :template_location => root + '/public/stylesheets/sass',
20
20
  :css_location => root + '/public/stylesheets',
21
21
  :cache_location => root + '/tmp/sass-cache',
@@ -9,19 +9,19 @@ module Sass
9
9
  #
10
10
  # ## Customize
11
11
  #
12
- # Sass::Plugin.options.merge(
12
+ # Sass::Plugin.options.merge!(
13
13
  # :cache_location => './tmp/sass-cache',
14
14
  # :never_update => environment != :production,
15
15
  # :full_exception => environment != :production)
16
16
  #
17
- # {file:SASS_REFERENCE.md#options See the Reference for more options}.
17
+ # {file:SASS_REFERENCE.md#Options See the Reference for more options}.
18
18
  #
19
19
  # ## Use
20
20
  #
21
21
  # Put your Sass files in `public/stylesheets/sass`.
22
22
  # Your CSS will be generated in `public/stylesheets`,
23
23
  # and regenerated every request if necessary.
24
- # The locations and frequency {file:SASS_REFERENCE.md#options can be customized}.
24
+ # The locations and frequency {file:SASS_REFERENCE.md#Options can be customized}.
25
25
  # That's all there is to it!
26
26
  class Rack
27
27
  # The delay, in seconds, between update checks.
@@ -2,7 +2,7 @@ unless defined?(Sass::RAILS_LOADED)
2
2
  Sass::RAILS_LOADED = true
3
3
 
4
4
  module Sass::Plugin::Configuration
5
- # Different default options in a rails envirionment.
5
+ # Different default options in a rails environment.
6
6
  def default_options
7
7
  return @default_options if @default_options
8
8
  opts = {
@@ -39,15 +39,15 @@ module Sass
39
39
  # for checking the staleness of several stylesheets at once.
40
40
  #
41
41
  # @param options [{Symbol => Object}]
42
- # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
42
+ # See {file:SASS_REFERENCE.md#Options the Sass options documentation}.
43
43
  def initialize(options)
44
44
  # URIs that are being actively checked for staleness. Protects against
45
45
  # import loops.
46
46
  @actively_checking = Set.new
47
47
 
48
48
  # Entries in the following instance-level caches are never explicitly expired.
49
- # Instead they are supposed to automaticaly go out of scope when a series of staleness checks
50
- # (this instance of StalenessChecker was created for) is finished.
49
+ # Instead they are supposed to automatically go out of scope when a series of staleness
50
+ # checks (this instance of StalenessChecker was created for) is finished.
51
51
  @mtimes, @dependencies_stale, @parse_trees = {}, {}, {}
52
52
  @options = Sass::Engine.normalize_options(options)
53
53
  end
@@ -72,7 +72,7 @@ module Sass
72
72
  # Returns whether a Sass or SCSS stylesheet has been modified since a given time.
73
73
  #
74
74
  # @param template_file [String] The location of the Sass or SCSS template.
75
- # @param mtime [Fixnum] The modification time to check against.
75
+ # @param mtime [Time] The modification time to check against.
76
76
  # @param importer [Sass::Importers::Base] The importer used to locate the stylesheet.
77
77
  # Defaults to the filesystem importer.
78
78
  # @return [Boolean] Whether the stylesheet has been modified.
@@ -103,7 +103,7 @@ module Sass
103
103
  # so it's better to use when checking multiple stylesheets at once.
104
104
  #
105
105
  # @param template_file [String] The location of the Sass or SCSS template.
106
- # @param mtime [Fixnum] The modification time to check against.
106
+ # @param mtime [Time] The modification time to check against.
107
107
  # @param importer [Sass::Importers::Base] The importer used to locate the stylesheet.
108
108
  # Defaults to the filesystem importer.
109
109
  # @return [Boolean] Whether the stylesheet has been modified.
@@ -156,7 +156,7 @@ module Sass
156
156
  end
157
157
 
158
158
  def dependency_updated?(css_mtime)
159
- Proc.new do |uri, importer|
159
+ proc do |uri, importer|
160
160
  next true if @actively_checking.include?(uri)
161
161
  begin
162
162
  @actively_checking << uri
data/lib/sass/plugin.rb CHANGED
@@ -11,7 +11,8 @@ module Sass
11
11
  # This module is used as the primary interface with Sass
12
12
  # when it's used as a plugin for various frameworks.
13
13
  # All Rack-enabled frameworks are supported out of the box.
14
- # The plugin is {file:SASS_REFERENCE.md#rails_merb_plugin automatically activated for Rails and Merb}.
14
+ # The plugin is
15
+ # {file:SASS_REFERENCE.md#Rack_Rails_Merb_Plugin automatically activated for Rails and Merb}.
15
16
  # Other frameworks must enable it explicitly; see {Sass::Plugin::Rack}.
16
17
  #
17
18
  # This module has a large set of callbacks available
@@ -32,7 +33,6 @@ module Sass
32
33
  # #=> Compiling app/sass/ie.scss to public/stylesheets/ie.css
33
34
  # @see Sass::Plugin::Compiler
34
35
  module Plugin
35
- include Sass::Util
36
36
  extend self
37
37
 
38
38
  @checked_for_updates = false
@@ -65,7 +65,8 @@ module Sass
65
65
 
66
66
  # Updates out-of-date stylesheets.
67
67
  #
68
- # Checks each Sass/SCSS file in {file:SASS_REFERENCE.md#template_location-option `:template_location`}
68
+ # Checks each Sass/SCSS file in
69
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location`}
69
70
  # to see if it's been modified more recently than the corresponding CSS file
70
71
  # in {file:SASS_REFERENCE.md#css_location-option `:css_location`}.
71
72
  # If it has, it updates the CSS file.
@@ -92,7 +93,8 @@ module Sass
92
93
  # the second is the location of the CSS file that it should be compiled to.
93
94
  # @see #update_stylesheets
94
95
  def force_update_stylesheets(individual_files = [])
95
- Compiler.new(options.dup.merge(
96
+ Compiler.new(
97
+ options.dup.merge(
96
98
  :never_update => false,
97
99
  :always_update => true,
98
100
  :cache => false)).update_stylesheets(individual_files)
@@ -119,13 +121,12 @@ module Sass
119
121
  def options
120
122
  compiler.options
121
123
  end
122
-
123
124
  end
124
125
  end
125
126
 
126
- # On Rails 3+ the rails plugin is loaded at the right time in railtie.rb
127
- if defined?(ActionController) && !Sass::Util.ap_geq_3?
128
- require 'sass/plugin/rails'
127
+ if defined?(ActionController)
128
+ # On Rails 3+ the rails plugin is loaded at the right time in railtie.rb
129
+ require 'sass/plugin/rails' unless Sass::Util.ap_geq_3?
129
130
  elsif defined?(Merb::Plugins)
130
131
  require 'sass/plugin/merb'
131
132
  else
data/lib/sass/repl.rb CHANGED
@@ -18,7 +18,7 @@ module Sass
18
18
  @line = 0
19
19
  loop do
20
20
  @line += 1
21
- unless text = Readline.readline('>> ')
21
+ unless (text = Readline.readline('>> '))
22
22
  puts
23
23
  return
24
24
  end
@@ -48,8 +48,8 @@ module Sass
48
48
  rescue Sass::SyntaxError => e
49
49
  puts "SyntaxError: #{e.message}"
50
50
  if @options[:trace]
51
- e.backtrace.each do |e|
52
- puts "\tfrom #{e}"
51
+ e.backtrace.each do |line|
52
+ puts "\tfrom #{line}"
53
53
  end
54
54
  end
55
55
  end
@@ -12,16 +12,20 @@ module Sass
12
12
 
13
13
  def string(re, *args)
14
14
  if re == :uri
15
- return unless uri = scan(URI)
16
- return [:string, Script::String.new(uri)]
15
+ uri = scan(URI)
16
+ return unless uri
17
+ return [:string, Script::Value::String.new(uri)]
17
18
  end
18
19
 
19
20
  return unless scan(STRING)
20
- [:string, Script::String.new((@scanner[1] || @scanner[2]).gsub(/\\(['"])/, '\1'), :string)]
21
+ string_value = Sass::Script::Value::String.value(@scanner[1] || @scanner[2])
22
+ value = Script::Value::String.new(string_value, :string)
23
+ [:string, value]
21
24
  end
22
25
 
23
26
  def important
24
- return unless s = scan(IMPORTANT)
27
+ s = scan(IMPORTANT)
28
+ return unless s
25
29
  [:raw, s]
26
30
  end
27
31
  end
@@ -17,8 +17,10 @@ module Sass
17
17
  production :div, :unary_plus, :div
18
18
 
19
19
  def string
20
- return number unless tok = try_tok(:string)
21
- return tok.value unless @lexer.peek && @lexer.peek.type == :begin_interpolation
20
+ tok = try_tok(:string)
21
+ return number unless tok
22
+ return if @lexer.peek && @lexer.peek.type == :begin_interpolation
23
+ literal_node(tok.value, tok.source_range)
22
24
  end
23
25
 
24
26
  # Short-circuit all the SassScript-only productions
@@ -0,0 +1,52 @@
1
+ module Sass
2
+ module Script
3
+ # An object tracking whether a warning has been emitted for a given script
4
+ # tree.
5
+ #
6
+ # This is shared among all objects in a script tree. Whenever any of those
7
+ # objects encounters a situation in which it wouldn't produce semantically
8
+ # identical CSS to its input, it calls \{#warn!\}. The first time \{#warn!}
9
+ # is called for a given warning object, it prints a deprecation warning.
10
+ class CssVariableWarning
11
+ def initialize
12
+ @warned = false
13
+ @value = nil
14
+ end
15
+
16
+ # Sets the root of the script tree that this warning refers to.
17
+ #
18
+ # @param value [Sass::Script::Tree::Node]
19
+ def value=(value)
20
+ warn_called = @warned && !@value
21
+ @value = value
22
+ print_warning if warn_called
23
+ end
24
+
25
+ # The first time this is called, it prints a deprecation warning.
26
+ #
27
+ # This may be called before \{#value=}. If it is, the warning is emitted
28
+ # once the script tree is set.
29
+ def warn!
30
+ return if @warned
31
+ @warned = true
32
+ return unless @value
33
+
34
+ print_warning
35
+ end
36
+
37
+ private
38
+
39
+ # Prints this node's warning.
40
+ def print_warning
41
+ of_filename = " of #{@value.filename}" if @value.filename
42
+ Sass::Util.sass_warn(
43
+ "DEPRECATION WARNING on line #{@value.line}#{of_filename}:\n" +
44
+ "Sass 3.6 will change the way CSS variables are parsed. Instead of being parsed as\n" +
45
+ "normal properties, they will not allow any Sass-specific behavior other than \#{}.\n" +
46
+ "For forwards-compatibility, use \#{}:\n" +
47
+ "\n" +
48
+ " --variable: \#{#{@value.to_sass}};")
49
+ end
50
+ end
51
+ end
52
+ end