compass-core 1.0.0.rc.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bdf3ed83a110afaf4b21a9a95d35ab21f30005d
4
- data.tar.gz: 16db580b6ea1afe477b6d77dd5704f60999cb121
3
+ metadata.gz: 30ed5fb87775781f177185dd819939e2baee183f
4
+ data.tar.gz: 90f6787c7e0e5155e690185078b7260cb6f73b49
5
5
  SHA512:
6
- metadata.gz: 2d731a439ad9191b6ccfbe09316aabdd1076116797d3abd8ae81198f42c82899cea0465bdfda82d4dfcbbf77bbd82c46474293bd1a6d84b6cb61e9b5133743d9
7
- data.tar.gz: da17ecf2006a0349ee5830914fc6d38693f8eddcd1358cab1938e267718304ecd454eacde0eaeb940493fb1994daf91713c973cf2d4d1a239cb196df2121cb73
6
+ metadata.gz: 93621889290a4d5ae72cf0bac8ee20b1bb4abce8c148aa0a31caa7a8620aaf3d4ff1d0a4662666488877e171f58403e530be1a507bb890aaed1dc592df1b9965
7
+ data.tar.gz: afca4711b754be1d06a17ece479feb817305019985a60e4ec3d6092890c81676ffab620b246c580bdaef57be03ca4e6c6096397174fa01287463d46d52cd66ae
@@ -99,6 +99,7 @@ module Compass
99
99
  :color_output,
100
100
  attributes_for_directory(:css, :stylesheets),
101
101
  :environment,
102
+ attributes_for_directory(:extensions, nil),
102
103
  :framework_path,
103
104
  attributes_for_directory(:javascripts),
104
105
  :line_comments,
@@ -110,6 +111,7 @@ module Compass
110
111
  :required_libraries,
111
112
  attributes_for_directory(:sass, nil),
112
113
  :sass_options,
114
+ :sourcemap,
113
115
  :sprite_engine,
114
116
  ].flatten
115
117
 
@@ -35,7 +35,11 @@ module Compass
35
35
  plugin_opts.merge!(sass_options || {})
36
36
  plugin_opts[:load_paths] ||= []
37
37
  plugin_opts[:load_paths] += resolve_additional_import_paths
38
- plugin_opts[:load_paths] << Compass::SpriteImporter.new
38
+ # TODO: When sprites are extracted to their own plugin, this
39
+ # TODO: will need to be extracted to there.
40
+ if defined?(Compass::SpriteImporter.new)
41
+ plugin_opts[:load_paths] << Compass::SpriteImporter.new
42
+ end
39
43
  plugin_opts[:full_exception] = (environment == :development)
40
44
  plugin_opts
41
45
  end
@@ -86,7 +90,11 @@ module Compass
86
90
  next p if p.respond_to?(:find_relative)
87
91
  importer.new(p.to_s)
88
92
  end
89
- load_paths << Compass::SpriteImporter.new
93
+ # TODO: When sprites are extracted to their own plugin, this
94
+ # TODO: will need to be extracted to there.
95
+ if defined?(Compass::SpriteImporter.new)
96
+ load_paths << Compass::SpriteImporter.new
97
+ end
90
98
  load_paths
91
99
  end
92
100
 
@@ -1,5 +1,5 @@
1
1
  module Compass
2
2
  module Core
3
- VERSION = "1.0.0.rc.1"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -11,6 +11,7 @@ end
11
11
  inline_image image_size constants gradient_support
12
12
  font_files lists colors math
13
13
  env cross_browser_support configuration
14
+ files
14
15
  ).each do |func|
15
16
  require "compass/core/sass_extensions/functions/#{func}"
16
17
  end
@@ -25,6 +26,7 @@ module Sass::Script::Functions
25
26
  include Compass::Core::SassExtensions::Functions::ImageSize
26
27
  include Compass::Core::SassExtensions::Functions::GradientSupport::Functions
27
28
  include Compass::Core::SassExtensions::Functions::FontFiles
29
+ include Compass::Core::SassExtensions::Functions::Files
28
30
  include Compass::Core::SassExtensions::Functions::Constants
29
31
  include Compass::Core::SassExtensions::Functions::Lists
30
32
  include Compass::Core::SassExtensions::Functions::Colors
@@ -85,9 +85,10 @@ module Compass::Core::SassExtensions::Functions::Configuration
85
85
 
86
86
  OPTION_TRANSFORMER = Hash.new() {|h, k| proc {|v, ctx| v.value } }
87
87
  OPTION_TRANSFORMER[:asset_cache_buster] = proc do |v, ctx|
88
- proc do |file|
88
+ proc do |url, file|
89
89
  if ctx.environment.function(v.value) || Sass::Script::Functions.callable?(v.value.tr('-', '_'))
90
- result = ctx.call(v, ctx.quoted_string(file))
90
+ result = ctx.call(v, ctx.quoted_string(url),
91
+ file.nil? ? ctx.null() : ctx.quoted_string(file.path))
91
92
  case result
92
93
  when Sass::Script::Value::String, Sass::Script::Value::Null
93
94
  result.value
@@ -35,7 +35,7 @@ module Compass::Core::SassExtensions::Functions::CrossBrowserSupport
35
35
  bool(needed)
36
36
  end
37
37
 
38
- %w(webkit moz o ms svg css2).each do |prefix|
38
+ %w(webkit moz o ms svg css2 owg).each do |prefix|
39
39
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
40
40
  # Syntactic sugar to apply the given prefix
41
41
  # -moz($arg) is the same as calling prefix(-moz, $arg)
@@ -0,0 +1,33 @@
1
+ require 'digest/md5'
2
+
3
+ module Compass::Core::SassExtensions::Functions::Files
4
+ extend Compass::Core::SassExtensions::Functions::SassDeclarationHelper
5
+ extend Sass::Script::Value::Helpers
6
+
7
+ def md5sum(file, format = nil)
8
+ assert_type file, :String
9
+ filename = nil
10
+ if options[:css_filename] && File.exists?(options[:css_filename])
11
+ filename = File.expand_path(file.value, File.dirname(options[:css_filename]))
12
+ elsif Pathname.new(file.value).absolute?
13
+ filename = file.value
14
+ end
15
+ if filename && File.exist?(filename)
16
+ assert_type file, :String if format
17
+ digest = Digest::MD5.new()
18
+ digest << File.read(filename)
19
+ if !format || format.value == "hex"
20
+ unquoted_string(digest.hexdigest)
21
+ elsif format && format.value == "integer"
22
+ number(digest.hexdigest.hex)
23
+ elsif format
24
+ raise Sass::SyntaxError, "Unknown format '#{format}' for md5sum"
25
+ end
26
+ else
27
+ raise Sass::SyntaxError, "File not found: #{file}"
28
+ end
29
+ end
30
+ declare :md5sum, [:file]
31
+ declare :md5sum, [:file, :format]
32
+ end
33
+
@@ -296,7 +296,16 @@ module Compass::Core::SassExtensions::Functions::GradientSupport
296
296
  def to_s_prefixed(options = self.options)
297
297
  to_s(options)
298
298
  end
299
-
299
+
300
+ def supports?(aspect)
301
+ # I don't know how to support radial old webkit gradients (owg)
302
+ if %w(owg).include?(aspect)
303
+ false
304
+ else
305
+ super
306
+ end
307
+ end
308
+
300
309
  standardized_prefix :webkit
301
310
  standardized_prefix :moz
302
311
 
@@ -418,14 +427,27 @@ module Compass::Core::SassExtensions::Functions::GradientSupport
418
427
  # I don't know how to support degree-based gradients in old webkit gradients (owg) or svg so we just disable them.
419
428
  if %w(owg).include?(aspect) && position_or_angle.is_a?(Sass::Script::Value::Number) && position_or_angle.numerator_units.include?("deg")
420
429
  false
421
- elsif aspect == "svg" && color_stops.value.any?{|cs| cs.stop.is_a?(Sass::Script::Value::String) }
422
- # calc expressions cannot be represented in svg
430
+ elsif %w(owg svg).include?(aspect) && color_stops.value.any?{|cs| cs.stop.is_a?(Sass::Script::Value::String) }
431
+ # calc expressions cannot be represented in svg or owg
423
432
  false
424
433
  else
425
434
  super
426
435
  end
427
436
  end
428
437
 
438
+ # Output the original webkit gradient syntax
439
+ def to_owg(options = self.options)
440
+ position_list = reverse_side_or_corner(position_or_angle)
441
+
442
+ start_point = grad_point(position_list)
443
+ args = []
444
+ args << start_point
445
+ args << linear_end_position(position_list, start_point, color_stops.value.last.stop)
446
+ args << grad_color_stops(color_stops)
447
+ args.each{|a| a.options = options}
448
+ Sass::Script::String.new("-webkit-gradient(linear, #{args.join(', ')})")
449
+ end
450
+
429
451
  def to_svg(options = self.options)
430
452
  linear_svg_gradient(color_stops, position_or_angle || identifier("top"))
431
453
  end
@@ -438,6 +460,24 @@ module Compass::Core::SassExtensions::Functions::GradientSupport
438
460
  module Functions
439
461
  include Sass::Script::Value::Helpers
440
462
 
463
+ def reverse_side_or_corner(position)
464
+ position_array = position.nil? ? [identifier('top')] : position.value.dup
465
+ if position_array.first == identifier('to')
466
+ # Remove the 'to' element from the array
467
+ position_array.shift
468
+
469
+ # Reverse all the positions
470
+ reversed_position = position_array.map do |pos|
471
+ opposite_position(pos)
472
+ end
473
+ else
474
+ # When the position does not have the 'to' element we don't need to
475
+ # reverse the direction of the gradient
476
+ reversed_position = position_array
477
+ end
478
+ opts(list(reversed_position, :space))
479
+ end
480
+
441
481
  def convert_angle_from_offical(deg)
442
482
  if deg.is_a?(Sass::Script::Value::Number)
443
483
  return number((deg.value.to_f - 450).abs % 360, 'deg')
@@ -582,7 +622,7 @@ module Compass::Core::SassExtensions::Functions::GradientSupport
582
622
  # returns color-stop() calls for use in webkit.
583
623
  def grad_color_stops(color_list)
584
624
  stops = color_stops_in_percentages(color_list).map do |stop, color|
585
- "color-stop(#{stop.inspect}, #{ColorStop.color_to_s(color)})"
625
+ Sass::Script::String.new("color-stop(#{stop.to_s}, #{ColorStop.color_to_s(color)})")
586
626
  end
587
627
  opts(list(stops, :comma))
588
628
  end
@@ -607,19 +647,23 @@ module Compass::Core::SassExtensions::Functions::GradientSupport
607
647
  end
608
648
 
609
649
  # only used for webkit
610
- def linear_end_position(position_or_angle, color_list)
611
- start_point = grad_point(position_or_angle || identifier("top"))
612
- end_point = grad_point(opposite_position(position_or_angle || identifier("top")))
613
- end_target = color_list.value.last.stop
650
+ def linear_end_position(position_or_angle, start_point, end_target)
651
+ end_point = grad_point(opposite_position(position_or_angle))
614
652
 
615
- if color_list.value.last.stop && color_list.value.last.stop.numerator_units == ["px"]
616
- new_end = color_list.value.last.stop.value
653
+ if end_target && end_target.numerator_units == ["px"]
617
654
  if start_point.value.first == end_point.value.first && start_point.value.last.value == 0
618
655
  # this means top-to-bottom
619
- end_point.value[1] = number(end_target.value)
656
+ new_end_point = end_point.value.dup
657
+ new_end_point[1] = number(end_target.value)
658
+
659
+ end_point = opts(list(new_end_point, end_point.separator))
620
660
  elsif start_point.value.last == end_point.value.last && start_point.value.first.value == 0
621
661
  # this implies left-to-right
622
- end_point.value[0] = number(end_target.value)
662
+
663
+ new_end_point = end_point.value.dup
664
+ new_end_point[0] = number(end_target.value)
665
+
666
+ end_point = opts(list(new_end_point, end_point.separator))
623
667
  end
624
668
  end
625
669
  end_point
@@ -750,7 +794,7 @@ module Compass::Core::SassExtensions::Functions::GradientSupport
750
794
  arg.all?{|a| color_stop?(a)} ? arg : nil
751
795
  end
752
796
  end
753
-
797
+
754
798
  def linear_svg(color_stops, x1, y1, x2, y2)
755
799
  gradient = %Q{<linearGradient id="grad" gradientUnits="objectBoundingBox" x1="#{x1}" y1="#{y1}" x2="#{x2}" y2="#{y2}">#{color_stops_svg(color_stops)}</linearGradient>}
756
800
  svg(gradient)
@@ -69,7 +69,7 @@ module Sass::Script
69
69
  "#{name}(#{args.map{|a| a.to_s(options)}.join(", ")})"
70
70
  end
71
71
 
72
- %w(webkit moz o ms svg css2).each do |prefix|
72
+ %w(webkit moz o ms svg css2 owg).each do |prefix|
73
73
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
74
74
  def to_#{prefix}(options = self.options)
75
75
  prefixed_args = args.map do |arg|
@@ -4,6 +4,7 @@
4
4
  $gradient-support-threshold: $graceful-usage-threshold !default;
5
5
  $svg-gradient-shim-threshold: $graceful-usage-threshold !default;
6
6
  $border-image-support-threshold: $graceful-usage-threshold !default;
7
+ $owg-threshold: $graceful-usage-threshold !default;
7
8
 
8
9
  // Compass assumes you will use the official gradient syntax,
9
10
  // unless otherwise instructed.
@@ -31,6 +32,9 @@ $use-legacy-gradient-syntax: false !default;
31
32
  // so we can shim the gradient with an inline svg file.
32
33
  $browsers-supporting-svg-but-not-gradients: (ie: "9", opera: "9.5-9.6");
33
34
 
35
+ // These browsers require the old webkit gradient syntax
36
+ $browsers-supporting-old-webkit-gradients: (android: ("2.1", "3"));
37
+
34
38
  @mixin each-gradient-prefix($values) {
35
39
  @if prefixed(-svg, $values) {
36
40
  @include for-legacy-browsers($browsers-supporting-svg-but-not-gradients,
@@ -41,6 +45,15 @@ $browsers-supporting-svg-but-not-gradients: (ie: "9", opera: "9.5-9.6");
41
45
  }
42
46
  }
43
47
  }
48
+ @if prefixed(-owg, $values) {
49
+ @include for-legacy-browsers($browsers-supporting-old-webkit-gradients,
50
+ $owg-threshold)
51
+ {
52
+ @include with-prefix(-owg) {
53
+ @content;
54
+ }
55
+ }
56
+ }
44
57
  @include with-each-prefix(css-gradients, $gradient-support-threshold) {
45
58
  @if $current-prefix {
46
59
  @if prefixed($current-prefix, $values) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Eppstein
@@ -11,68 +11,68 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-08-04 00:00:00.000000000 Z
14
+ date: 2014-08-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sass
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 3.3.0
23
- - - <
23
+ - - "<"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '3.5'
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 3.3.0
33
- - - <
33
+ - - "<"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '3.5'
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_json
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '1.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '1.0'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: bundler
52
52
  requirement: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: rake
66
66
  requirement: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  type: :development
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  description: The Compass core stylesheet library and minimum required ruby extensions.
@@ -84,6 +84,7 @@ executables: []
84
84
  extensions: []
85
85
  extra_rdoc_files: []
86
86
  files:
87
+ - LICENSE.txt
87
88
  - data/caniuse.json
88
89
  - data/caniuse_extras/css-placeholder.json
89
90
  - lib/compass-core.rb
@@ -107,6 +108,7 @@ files:
107
108
  - lib/compass/core/sass_extensions/functions/display.rb
108
109
  - lib/compass/core/sass_extensions/functions/enumerate.rb
109
110
  - lib/compass/core/sass_extensions/functions/env.rb
111
+ - lib/compass/core/sass_extensions/functions/files.rb
110
112
  - lib/compass/core/sass_extensions/functions/font_files.rb
111
113
  - lib/compass/core/sass_extensions/functions/gradient_support.rb
112
114
  - lib/compass/core/sass_extensions/functions/image_size.rb
@@ -226,7 +228,6 @@ files:
226
228
  - templates/project/manifest.rb
227
229
  - templates/project/print.sass
228
230
  - templates/project/screen.sass
229
- - LICENSE.txt
230
231
  homepage: http://compass-style.org/reference/compass/
231
232
  licenses:
232
233
  - MIT
@@ -237,17 +238,17 @@ require_paths:
237
238
  - lib
238
239
  required_ruby_version: !ruby/object:Gem::Requirement
239
240
  requirements:
240
- - - '>='
241
+ - - ">="
241
242
  - !ruby/object:Gem::Version
242
243
  version: '0'
243
244
  required_rubygems_version: !ruby/object:Gem::Requirement
244
245
  requirements:
245
- - - '>'
246
+ - - ">="
246
247
  - !ruby/object:Gem::Version
247
- version: 1.3.1
248
+ version: '0'
248
249
  requirements: []
249
250
  rubyforge_project:
250
- rubygems_version: 2.0.3
251
+ rubygems_version: 2.2.2
251
252
  signing_key:
252
253
  specification_version: 4
253
254
  summary: The Compass core stylesheet library