SassyLists 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Changelog
2
2
 
3
+ * `0.2.4`: improving `debug()`
3
4
  * `0.2.3`: fixing important issues with comments
4
5
  * `0.2.2`: moving all comments to invisible
5
6
  * `0.2.1`: fixing an issue with `random-value()`
data/lib/SassyLists.rb CHANGED
@@ -5,8 +5,8 @@ Compass::Frameworks.register('SassyLists', :path => extension_path)
5
5
  # Version is a number. If a version contains alphas, it will be created as a prerelease version
6
6
  # Date is in the form of YYYY-MM-DD
7
7
  module SassyLists
8
- VERSION = "0.2.3"
9
- DATE = "2013-10-29"
8
+ VERSION = "0.2.4"
9
+ DATE = "2013-11-01"
10
10
  end
11
11
 
12
12
  module Sass::Script::Functions
@@ -6,63 +6,67 @@
6
6
  // @example debug(a b (c d e)) => [ a, b, [ c, d, e ] ]
7
7
  // -------------------------------------------------------------------------------
8
8
  // @param $list [List] : list
9
- // @param $type [Boolean] : enable/disable variables type
10
- // @param $root [Boolean] : strictly internal boolean for recursivity
9
+ // @param $pre [Boolean] : enable/disable variables type and proper indentation
10
+ // @param $level [Number] : internal variable for recursivity
11
11
  // -------------------------------------------------------------------------------
12
12
  // @return [String]
13
13
 
14
- @function debug($list, $type: true, $root: true) {
15
- @if length($list) == 1 {
16
- @return if($type, quote("(#{type-of($list)}) #{$list}"), quote("#{$list}"));
17
- }
18
-
19
- $result : if($type, unquote("(list:#{length($list)})[ \A "), unquote("[ \A "));
20
- $space : if($root, "", " ");
14
+ @function debug($list, $pre: false, $level: 1) {
15
+ @debug $level;
16
+ $tab : " ";
17
+ $indent : "";
18
+ $break : if($pre, "\A ", "");
21
19
 
22
- @each $item in $list {
23
- $result : unquote("#{$result} ");
24
-
25
- @if length($item) > 1 {
26
- $result : unquote("#{$result}#{debug($item, $type, false)}");
20
+ @for $i from 1 to $level {
21
+ $indent : $indent + $tab;
27
22
  }
28
23
 
29
- @else {
30
- $result : if($type,
31
- unquote("#{$result}#{$space}(#{type-of($item)}) #{$item}"),
32
- unquote("#{$result}#{$space}#{$item}")
33
- );
34
- }
24
+ $result: "[" + $break;
25
+
26
+ @each $item in $list {
27
+ $result: $result + if($pre, $indent + $tab, " ");
28
+
29
+ @if length($item) > 1 {
30
+ $result: $result
31
+ + if($pre, "(list: " + length($item) + ") ", "")
32
+ + debug($item, $pre, $level + 1);
33
+ }
34
+
35
+ @else {
36
+ $result: $result
37
+ + if($pre, "(" + type-of($item) + ") ", "")
38
+ + $item;
39
+ }
35
40
 
36
- @if index($list, $item) != length($list) {
37
- $result : unquote("#{$result}, \A ");
41
+ @if index($list, $item) != length($list) {
42
+ $result: $result + "," + $break;
43
+ }
38
44
  }
39
45
 
40
- }
46
+ $result: $result + $break + if($pre, if($level > 1, $indent, ""), " ") + "]";
41
47
 
42
- $result : unquote("#{$result}\A #{$space}]");
43
- @return quote($result);
48
+ @return quote($result);
44
49
  }
45
50
 
46
51
  // Mixin displaying clean debug
47
52
  // -------------------------------------------------------------------------------
48
53
  // @param $list [List] : list
49
- // @param $type [List] : enable/disable variables type
50
54
 
51
- @mixin debug($list, $type: true) {
52
- body:before {
53
- content: debug($list, $type) !important;
54
-
55
- display: block !important;
56
- margin: 1em !important;
57
- padding: .5em !important;
58
-
59
- background: #EFEFEF !important;
60
- border: 1px solid #DDD !important;
61
- border-radius: .2em !important;
62
-
63
- color: #333 !important;
64
- font: .75em/1.5 "Courier New", monospace !important;
65
- text-shadow: 0 1px white !important;
66
- white-space: pre-wrap !important;
67
- }
55
+ @mixin debug($list) {
56
+ body:before {
57
+ content: debug($list, true) !important;
58
+
59
+ display: block !important;
60
+ margin: 1em !important;
61
+ padding: .5em !important;
62
+
63
+ background: #EFEFEF !important;
64
+ border: 1px solid #DDD !important;
65
+ border-radius: .2em !important;
66
+
67
+ color: #333 !important;
68
+ font: .75em/1.5 "Courier New", monospace !important;
69
+ text-shadow: 0 1px white !important;
70
+ white-space: pre-wrap !important;
71
+ }
68
72
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SassyLists
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-29 00:00:00.000000000 Z
12
+ date: 2013-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass