singularitygs 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/singularitygs.rb CHANGED
@@ -4,6 +4,6 @@ require 'breakpoint'
4
4
  Compass::Frameworks.register("singularitygs", :path => "#{File.dirname(__FILE__)}/..")
5
5
 
6
6
  module SingularityGS
7
- VERSION = "1.0.4"
8
- DATE = "2013-04-03"
7
+ VERSION = "1.0.5"
8
+ DATE = "2013-04-05"
9
9
  end
@@ -30,16 +30,16 @@
30
30
 
31
31
  @if $end-row {
32
32
  float: $opp;
33
+ margin-#{$opp}: 0%;
33
34
  }
34
35
  @else {
35
36
  float: $dir;
36
37
 
37
38
  @if $start-row {
38
39
  margin-#{$dir}: 0%;
40
+
39
41
  }
40
- @else {
41
- margin-#{$opp}: gutter-span($gutter, $columns);
42
- }
42
+ margin-#{$opp}: gutter-span($gutter, $columns);
43
43
  }
44
44
  }
45
45
 
@@ -56,6 +56,7 @@
56
56
 
57
57
  @if $end-row {
58
58
  float: $opp;
59
+ margin-#{$opp}: 0%;
59
60
  }
60
61
  @else {
61
62
  float: $dir;
@@ -63,11 +64,6 @@
63
64
  @if $start-row {
64
65
  margin-#{$dir}: 0%;
65
66
  }
66
- @else {
67
- margin-#{$opp}: gutter-span($gutter, $columns);
68
- }
69
-
70
- margin-#{$dir}: 0;
71
67
  margin-#{$opp}: gutter-span($gutter, $columns);
72
68
  }
73
69
  }
@@ -1,10 +1,29 @@
1
- @function add-grid($grid-definition) {
2
- $parsed: parse-add($grid-definition);
3
-
4
- @if nth($parsed, 2) == false and length($grids) == 0 {
5
- @return nth($parsed, 1);
1
+ // Accepts a grid definition in the human-readable format. Converts it to the internal format,
2
+ // appends it to a list of grids and returns the resulting list.
3
+ //
4
+ // Note that this function only returns a new list, it does not modify the source list.
5
+ //
6
+ // add-grid($grid-definition, $append-to-list)
7
+ // - $grid-definition : <definition> See documentation for syntax:
8
+ // https://github.com/Team-Sass/Singularity/wiki/Creating-Grids
9
+ // - $append-to-list : [list] A list to append to.
10
+ // Defaults to $grids if none is specified.
11
+ @function add-grid($grid-definition, $append-to-list: $grids) {
12
+ $parsed: parse-add($grid-definition); // Converts the definiton to a temporary format:
13
+ // either `((<grid>))` or `((<grid>) (<breakpoint>))`
14
+ $grid: nth($parsed, 1); // E. g. `(<grid>)`.
15
+ $breakpoint: nth($parsed, 2); // Either `(<breakpoint>)` or false.
16
+ $list-length: length($append-to-list);
17
+
18
+ // Check whether the definition will be the first one in the list
19
+ // and whether it has no breakpoint specified.
20
+ @if $breakpoint == false and $list-length == 0 {
21
+ // Returns the first item of the list, e. g. `(<grid>)`
22
+ @return $grid;
6
23
  }
7
24
  @else {
8
- @return append($grids, (nth($parsed, 1) nth($parsed, 2)), 'comma');
25
+ // Appends to a comma-separated list of definitions in the internal format
26
+ // and returns it, e. g. `(<grid>), (<grid> <breakpoint>), (<grid> <breakpoint>)`
27
+ @return append($append-to-list, ($grid $breakpoint), 'comma');
9
28
  }
10
- }
29
+ }
@@ -1,10 +1,29 @@
1
- @function add-gutter($gutter-definition) {
2
- $parsed: parse-add($gutter-definition);
1
+ // Accepts a gutter definition in the human-readable format. Converts it to the internal format,
2
+ // appends it to a list of gutter and returns the resulting list.
3
+ //
4
+ // Note that this function only returns a new list, it does not modify the source list.
5
+ //
6
+ // add-gutter($grid-definition, $append-to-list)
7
+ // - $gutter-definition : <definition> See documentation for syntax:
8
+ // https://github.com/Team-Sass/Singularity/wiki/Creating-Grids
9
+ // - $append-to-list : [list] A list to append to.
10
+ // Defaults to $gutters if none is specified.
11
+ @function add-gutter($gutter-definition, $append-to-list: $gutters) {
12
+ $parsed: parse-add($gutter-definition); // Converts the definiton to a temporary format:
13
+ // either `((<gutter>))` or `((<gutter>) (<breakpoint>))`
14
+ $gutter: nth($parsed, 1); // E. g. `(<gutter>)`.
15
+ $breakpoint: nth($parsed, 2); // Either `(<breakpoint>)` or false.
16
+ $list-length: length($append-to-list);
3
17
 
4
- @if nth($parsed, 2) == false and length($gutters) == 0 {
5
- @return nth($parsed, 1);
18
+ // Check whether the definition will be the first one in the list
19
+ // and whether it has no breakpoint specified.
20
+ @if $breakpoint == false and $list-length == 0 {
21
+ // Returns the first item of the list, e. g. `(<gutter>)`
22
+ @return $gutter;
6
23
  }
7
24
  @else {
8
- @return append($gutters, (nth($parsed, 1) nth($parsed, 2)), 'comma');
25
+ // Appends to a comma-separated list of definitions in the internal format
26
+ // and returns it, e. g. `(<gutter>), (<gutter> <breakpoint>), (<gutter> <breakpoint>)`
27
+ @return append($append-to-list, ($gutter $breakpoint), 'comma');
9
28
  }
10
- }
29
+ }
@@ -13,5 +13,5 @@
13
13
  $user-gutter: .25;
14
14
  }
15
15
 
16
- @return find-object($gutters, $user-gutter);
16
+ @return nth(find-object($gutters, $user-gutter), 1);
17
17
  }
@@ -38,35 +38,40 @@
38
38
  $context: $query-max;
39
39
  }
40
40
 
41
-
42
- // If it's smallest than the smallest MQ, use the 1st grid
43
- @if $context < $smallest {
44
- @return nth($haystack, 1);
45
- }
46
- // If it's larger than or equal to the largest MQ, use the last grid
47
- @else if $context >= $largest {
48
- @return nth(nth($reverse-haystack, 1), 1);
49
- }
50
- // If it's in between the smallest and largest, go run a check.
51
- @else {
52
- // Loop through each MQ.
53
- @for $j from 1 through $rg-length {
54
- $query: nth(nth($reverse-haystack, $j), 2);
55
-
56
- // If the MQ is greather than or equal to the the MQ in question, use it! (mobile first)
57
- @if ($mobile-first) {
58
- @if $context >= $query {
59
- @return nth(nth($reverse-haystack, $j), 1);
60
- }
41
+ // Loop over each item in Context to find if any of the items pass.
42
+ @each $query-context in $context {
43
+ @if $query-context != false {
44
+ // If it's smallest than the smallest MQ, use the 1st grid
45
+ @if $query-context < $smallest {
46
+ @return nth($haystack, 1);
47
+ }
48
+ // If it's larger than or equal to the largest MQ, use the last grid
49
+ @else if $query-context >= $largest {
50
+ @return nth(nth($reverse-haystack, 1), 1);
61
51
  }
62
- // If the MQ is less than or equal to the the MQ in question, use it! (not mobile first)
52
+ // If it's in between the smallest and largest, go run a check.
63
53
  @else {
64
- @if $context <= $query {
65
- @return nth(nth($reverse-haystack, $j), 1);
54
+ // Loop through each MQ.
55
+ @for $j from 1 through $rg-length {
56
+ $query: nth(nth($reverse-haystack, $j), 2);
57
+
58
+ // If the MQ is greather than or equal to the the MQ in question, use it! (mobile first)
59
+ @if ($mobile-first) {
60
+ @if $query-context >= $query {
61
+ @return nth(nth($reverse-haystack, $j), 1);
62
+ }
63
+ }
64
+ // If the MQ is less than or equal to the the MQ in question, use it! (not mobile first)
65
+ @else {
66
+ @if $query-context <= $query {
67
+ @return nth(nth($reverse-haystack, $j), 1);
68
+ }
69
+ }
66
70
  }
67
71
  }
68
72
  }
69
73
  }
74
+ @return nth($haystack, 1);
70
75
  }
71
76
  // All else fails, return the first grid
72
77
  @else {
@@ -1,7 +1,8 @@
1
+ <% project_name = File.basename(Compass.configuration.project_path) %><% project_js = Compass.configuration.javascripts_dir %><% project_css = Compass.configuration.css_dir %>
1
2
  <html>
2
3
  <head>
3
4
  <title>Singularity HTML Demo</title>
4
- <link rel="stylesheet" href="stylesheets/demo-float.css">
5
+ <link rel="stylesheet" href="<%= project_css %>/demo-float.css">
5
6
  </head>
6
7
  <body>
7
8
  <div id="page">
@@ -1,7 +1,8 @@
1
+ <% project_name = File.basename(Compass.configuration.project_path) %><% project_js = Compass.configuration.javascripts_dir %><% project_css = Compass.configuration.css_dir %>
1
2
  <html>
2
3
  <head>
3
4
  <title>Singularity HTML Demo</title>
4
- <link rel="stylesheet" href="stylesheets/demo-isolation.css">
5
+ <link rel="stylesheet" href="<%= project_css %>/demo-isolation.css">
5
6
  </head>
6
7
  <body>
7
8
  <div id="page">
@@ -1,8 +1,8 @@
1
1
  description "Singularity Demos"
2
2
 
3
3
  discover :stylesheets
4
- file 'isolation.html', :to => 'isolation.html'
5
- file 'float.html', :to => 'float.html'
4
+ file 'isolation.html.erb', :to => 'isolation.html', :erb => true
5
+ file 'float.html.erb', :to => 'float.html', :erb => true
6
6
 
7
7
  help %Q{
8
8
  For help with Singularity, please ask a question on Stack Overflow (http://stackoverflow.com/questions/ask) tagged with "singularitygs".
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 4
9
- version: 1.0.4
8
+ - 5
9
+ version: 1.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Scott Kellum
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-04-03 00:00:00 -04:00
18
+ date: 2013-04-05 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,10 +54,10 @@ dependencies:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  segments:
57
+ - 2
58
+ - 0
57
59
  - 1
58
- - 1
59
- - 1
60
- version: 1.1.1
60
+ version: 2.0.1
61
61
  type: :runtime
62
62
  version_requirements: *id003
63
63
  description: Advanced responsive grid system for Sass and Compass
@@ -105,8 +105,8 @@ files:
105
105
  - templates/box-sizing/manifest.rb
106
106
  - templates/demos/demo-float.scss
107
107
  - templates/demos/demo-isolation.scss
108
- - templates/demos/float.html
109
- - templates/demos/isolation.html
108
+ - templates/demos/float.html.erb
109
+ - templates/demos/isolation.html.erb
110
110
  - templates/demos/manifest.rb
111
111
  - templates/project/grid.js
112
112
  - templates/project/grid.min.js