gridtacular 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/_gridtacular.scss +280 -0
  3. metadata +73 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6b421dfea294b15cc6b5bf78b4f1511d3bea25e9
4
+ data.tar.gz: 0457670c28abd10f6b8acbbc59c5a9cd92b6d493
5
+ SHA512:
6
+ metadata.gz: 1fcff141448594bf632d0e8fbb938a8c3bbce92c7e1bf424f3783d6eb6e7ee18c69f73ae6b04f7ca9f50e77febdda0df829e7ebbcf2d68b9f8d1b4c7c501e02d
7
+ data.tar.gz: 8553dba6c33143ba93a576ffaed26e24d7b4ff8441b59f8df5cb89cba6eff33054169a1384435bf7623e6bdef05ef9038b700af202cc04ff03b2a748979cd449
data/_gridtacular.scss ADDED
@@ -0,0 +1,280 @@
1
+ //
2
+ // Flexbones Grid System
3
+ //
4
+ // Version 1.2
5
+ // Author: Rory Ashford
6
+ //
7
+
8
+
9
+ // Clearfix mixin
10
+ //
11
+ // Used to clear the floats within each grid
12
+ @mixin clearfix() {
13
+ *zoom:1;
14
+ &:before, &:after {
15
+ content:"";
16
+ display:table;
17
+ flex-basis: 0; // flexbox clear fix
18
+ order: 1; // flexbox clear fix
19
+ }
20
+ &:after { clear:both; }
21
+ }
22
+
23
+
24
+ // Column Width
25
+ //
26
+ // Works out the percent width of columns (gutters can be
27
+ // any unit but columns are always percent bases)
28
+ @function column-width($number-of-columns,$total-columns) {
29
+ $single-col-width: 100 / $total-columns * 1%;
30
+ @return $single-col-width * $number-of-columns;
31
+ }
32
+
33
+
34
+ // At Breakpoint
35
+ //
36
+ // A mixin for outputting inline media queries
37
+ // Just supply a Sass list as an argument with a min/max
38
+ // If there are no min and max values supplied then it
39
+ // doesnt ouput a media query
40
+ @mixin at-breakpoint($min,$max:null){
41
+ @if($max == null and $min != null){
42
+ @media (min-width: $min){
43
+ @content;
44
+ }
45
+ } @elseif($min == null and $max == null) {
46
+ @content;
47
+ } @else{
48
+ @media (min-width: $min) and (max-width: $max){
49
+ @content;
50
+ }
51
+ }
52
+ }
53
+
54
+
55
+ // Span Columns
56
+ //
57
+ // Used to set grids semantically from within
58
+ // the stylesheet with no additional HTML markup
59
+ @mixin span-columns($columns, $total-columns){
60
+ width: column-width($columns,$total-columns);
61
+ padding-left: $gutter-width;
62
+ }
63
+
64
+
65
+ // Grid
66
+ //
67
+ // Called once per breakpoint as the gutters may be different
68
+ // Float all direct children of the grid.
69
+ // Adds negative padding to each row
70
+ // Display flex and flex-wrap are used here to prevent content from
71
+ // floating into above elements
72
+ @mixin grid($gutter){
73
+ .grid{
74
+ margin-left: -$gutter;
75
+ @include clearfix();
76
+ }
77
+
78
+ // Float children
79
+ .grid > * {
80
+ float: left;
81
+ position: relative;
82
+ padding-left: $gutter;
83
+ }
84
+
85
+ }
86
+
87
+
88
+ // Equal height Grid items
89
+ //
90
+ // Uses flexbox so no IE support but there is a polyfill:
91
+ // http://osvaldas.info/flexbox-based-responsive-equal-height-blocks-with-javascript-fallback
92
+ //
93
+ // EXPERIMENTAL (Disabled in current build)
94
+ // feels extremely hacky, doesnt scale particularly well
95
+ // should it be called per media query?
96
+ @mixin grid-equal-height($gutter,$column-name){
97
+ .grid--equal-height{
98
+ display: flex;
99
+ flex-wrap: wrap;
100
+ > * {
101
+ display: flex;
102
+ // ugly ass fix for block level elements 100% children of adisplay: flex container.
103
+ > * {
104
+ width: 100%;
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+
111
+ // Grid with no gutters
112
+ @mixin grid-no-gutter($column-class,$suffix: null){
113
+ .grid--no-gutter#{$suffix}{
114
+ margin-left: 0;
115
+
116
+ > * {
117
+ padding-left: 0;
118
+ }
119
+ }
120
+ }
121
+
122
+
123
+ // Equivalent Fractions
124
+ //
125
+ // This function will add additional classes
126
+ // to make the grid system more expressive.
127
+ // Instead of writing 3/12 you can also write 1/4
128
+ // with this function
129
+ @function equivalent-fractions($numerator,$denominator){
130
+ $fractions: ();
131
+ @for $i from -$numerator through -1{
132
+ @if($numerator % abs($i) == 0 and $denominator % abs($i) == 0){
133
+ $fractions: map-merge($fractions, abs($i) #{$numerator/abs($i)}-#{$denominator/abs($i)});
134
+ }
135
+ }
136
+ // return map of all fractions
137
+ @return $fractions;
138
+ }
139
+
140
+
141
+ // Grid Columns
142
+ //
143
+ // Set the grid column widths based on the number of
144
+ // columns divided by the total number of columns.
145
+ @mixin grid-columns($prefix: null, $suffix: null, $columns: null, $fifths: false, $sevenths: false){
146
+ @for $i from 1 through $columns{
147
+ $css-classes: equivalent-fractions($i,$columns);
148
+ $column-class: null;
149
+
150
+ @each $css-class in $css-classes{
151
+ $column-class: $column-class,
152
+ #{ $prefix }#{ value( $css-class ) }#{ $suffix };
153
+ }
154
+
155
+ #{$column-class}{
156
+ width: column-width($i,$columns);
157
+ }
158
+ }
159
+
160
+ // Add fifths where total columns
161
+ // doesnt divide into fifths.
162
+ @if($fifths == true){
163
+ @for $i from 1 through 5{
164
+ $fifth_class: #{$prefix}#{$i}+'-5'+ #{$suffix};
165
+
166
+ #{$fifth_class}{
167
+ width: column-width($i,5);
168
+ }
169
+ }
170
+ }
171
+
172
+ // Add sevenths where total columns
173
+ // doesnt divide into fifths.
174
+ @if($sevenths == true){
175
+ @for $i from 1 through 7{
176
+ $seventh_class: #{$prefix}#{$i}+'-7'+ #{$suffix};
177
+
178
+ #{$seventh_class}{
179
+ width: column-width($i,7);
180
+ }
181
+ }
182
+ }
183
+ }
184
+
185
+
186
+ // Push Class
187
+ //
188
+ // Set the push classes that will incrementally indent
189
+ // the column by a maximum number of total-columns -1
190
+ @mixin grid-push($prefix: null, $suffix: null, $columns: null){
191
+ @for $i from 1 through $columns - 1{
192
+ $css-classes: equivalent-fractions($i,$columns);
193
+ $push-class: null;
194
+
195
+ @each $css-class in $css-classes{
196
+ $push-class: $push-class,
197
+ #{ $prefix }#{ value($css-class) }#{ $suffix };
198
+ }
199
+
200
+ #{$push-class}{
201
+ margin-left: column-width($i,$columns);
202
+ }
203
+ }
204
+ }
205
+
206
+
207
+ // Omega class
208
+ //
209
+ // An omega declaration that is breakpoint specific
210
+ // Basically it floats an element to the right taking
211
+ // it out of order potentially.
212
+ @mixin grid-omega($prefix: null, $suffix: null){
213
+ #{$prefix}omega#{$suffix} {
214
+ float: right;
215
+ }
216
+ }
217
+
218
+
219
+ // Debug
220
+ //
221
+ // Outputs the current breakpoint name to quickly debug
222
+ // each breakpoint.
223
+ @mixin grid-debug($breakpoint-name,$debug-bg: #000){
224
+ body:after{
225
+ position: fixed;
226
+ display: block;
227
+ bottom: 10px;
228
+ right: 10px;
229
+ padding: 5px 20px;
230
+ font-size: 14px;
231
+ font-weight: bold;
232
+ color: white;
233
+ background: $debug-bg;
234
+ content: "#{$breakpoint-name}";
235
+ }
236
+ }
237
+
238
+
239
+ // Grid Generate
240
+ //
241
+ // Pulls the whole thing together ready for output
242
+ // kept seperate from grid-generate as it is DRYer
243
+ // this way.
244
+ @mixin grid-generate($grid-args){
245
+
246
+ // This solution will ONLY work with libsass and
247
+ // sass-list-maps polyfill, will add code for
248
+ // sass3.3+ support later
249
+
250
+ $grids: map-get-z($grid-args, grids);
251
+ $column-name: map-get-z($grid-args, config, columnclass);
252
+ $column-prefix: #{'.' + $column-name};
253
+ $push-prefix: #{'.' + map-get-z($grid-args, config, pushclass)};
254
+ $debug-display: map-get-z($grid-args, config, debug);
255
+
256
+ @each $grid in $grids{
257
+ $columns: map-get(value($grid),columns);
258
+ $suffix: map-get(value($grid),suffix);
259
+ $breakpoint: map-get(value($grid),breakpoint);
260
+ $gutter: map-get(value($grid),gutter);
261
+
262
+ // Debug info
263
+ $debug-bg: map-get-z(value($grid),debug,background);
264
+ $debug-name: map-get-z(value($grid),debug,name);
265
+
266
+ // Include the necessary mixins to generate the grids
267
+
268
+ @include at-breakpoint($breakpoint){
269
+ @include grid($gutter);
270
+ @include grid-no-gutter($column-name,$suffix);
271
+ //@include grid-equal-height($gutter,$column-name); //Currently disabled
272
+ @include grid-columns($column-prefix,$suffix,$columns,true, true);
273
+ @include grid-push($push-prefix, $suffix, $columns);
274
+ @include grid-omega($column-prefix, $suffix);
275
+ @if( $debug-display == true ){
276
+ @include grid-debug($debug-name,$debug-bg)
277
+ }
278
+ }
279
+ }
280
+ }
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gridtacular
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rory Ashford
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Powerful grid system that fits into your existing workflow.
42
+ email:
43
+ - rory@roikles.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - _gridtacular.scss
49
+ homepage: ''
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.2.2
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Gridtacular — Sass Grid system
73
+ test_files: []