SassyLists 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/SassyLists.rb CHANGED
@@ -17,7 +17,7 @@ Compass::Frameworks.register('SassyLists', :path => extension_path)
17
17
  # a prerelease version
18
18
  # Date is in the form of YYYY-MM-DD
19
19
  module SassyLists
20
- VERSION = "0.1.1"
20
+ VERSION = "0.1.2"
21
21
  DATE = "2013-10-16"
22
22
  end
23
23
 
@@ -6,29 +6,62 @@
6
6
  * @example debug( a ) => [ a ]
7
7
  * -------------------------------------------------------------------------------
8
8
  * @param $list [List] : list
9
+ * @param $type [List] : enable/disable variables type
10
+ * @param $root [Boolean] : strictly internal boolean for recursivity
9
11
  * -------------------------------------------------------------------------------
10
12
  * @return [String]
11
13
  */
12
- @function debug($list) {
13
- $result: #{"[ "};
14
+ @function debug($list, $type: false, $root: true) {
15
+ $result: #{"[ \A "};
14
16
 
15
17
  @each $item in $list {
18
+ $result: $result#{" "};
16
19
 
17
20
  @if length($item) > 1 {
18
- $result: $result#{debug($item)};
21
+ $result: $result#{debug($item, $type, false)};
19
22
  }
20
23
 
21
24
  @else {
22
- $result: $result#{$item};
25
+ $space: if(not $root, " ", "");
26
+ $result: if($type,
27
+ $result#{$space}#{"("}#{type-of($item)}#{") "}#{$item},
28
+ $result#{$space}#{$item}
29
+ );
23
30
  }
24
31
 
25
32
  @if index($list, $item) != length($list) {
26
- $result: $result#{", "};
33
+ $result: $result#{", \A "};
27
34
  }
28
35
 
29
- }
30
-
31
- $result: $result#{" ]"};
36
+ }
32
37
 
38
+ $result: if($root,
39
+ $result#{"\A"}#{" ]"},
40
+ $result#{"\A"}#{" "}#{" ]"});
33
41
  @return quote($result);
34
42
  }
43
+
44
+ /**
45
+ * Mixin displaying clean debug
46
+ * -------------------------------------------------------------------------------
47
+ * @param $list [List] : list
48
+ * @param $type [List] : enable/disable variables type
49
+ */
50
+ @mixin debug($list, $type: false) {
51
+ body:before {
52
+ content: debug($list, $type) !important;
53
+
54
+ display: block !important;
55
+ margin: 1em !important;
56
+ padding: .5em !important;
57
+
58
+ background: #EFEFEF !important;
59
+ border: 1px solid #DDD !important;
60
+ border-radius: .2em !important;
61
+
62
+ color: #333 !important;
63
+ font: .75em/1.5 "Courier New", monospace !important;
64
+ text-shadow: 0 1px white !important;
65
+ white-space: pre-wrap !important;
66
+ }
67
+ }
@@ -7,23 +7,23 @@
7
7
  * -------------------------------------------------------------------------------
8
8
  * @param $list [List] : list
9
9
  * @param $glue [String] : value to use as a join string
10
- * @param $is-nested [Boolean] : strictly internal boolean for recursivity
10
+ * @param $root [Boolean] : strictly internal boolean for recursivity
11
11
  * -------------------------------------------------------------------------------
12
12
  * @return [String]
13
13
  */
14
- @function to-string($list, $glue: '', $is-nested: false) {
14
+ @function to-string($list, $glue: '', $root: true) {
15
15
  $result: null;
16
16
 
17
17
  @each $item in $list {
18
18
  @if length($item) > 1 {
19
- $result: $result#{to-string($item, $glue, true)};
19
+ $result: $result#{to-string($item, $glue, false)};
20
20
  }
21
21
 
22
22
  @else {
23
- $condition: index($list, item) != length($list) or $is-nested;
23
+ $condition: index($list, $item) != length($list) or not $root;
24
24
  $result: if($condition, $result#{$item}#{$glue}, $result#{$item});
25
25
  }
26
26
  }
27
27
 
28
- @return $result;
28
+ @return quote($result);
29
29
  }
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.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: