singularitygs 1.0.alpha.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/singularitygs.rb +2 -3
- data/stylesheets/_singularitygs.scss +45 -56
- data/stylesheets/singularitygs/_api.scss +39 -0
- data/stylesheets/singularitygs/_grids.scss +2 -0
- data/stylesheets/singularitygs/_gutters.scss +2 -0
- data/stylesheets/singularitygs/_helpers.scss +15 -3
- data/stylesheets/singularitygs/_language.scss +3 -0
- data/stylesheets/singularitygs/_math.scss +3 -0
- data/stylesheets/singularitygs/api/_float.scss +93 -0
- data/stylesheets/singularitygs/api/_isolation.scss +48 -0
- data/stylesheets/singularitygs/grids/_add.scss +10 -0
- data/stylesheets/singularitygs/grids/_find.scss +17 -0
- data/stylesheets/singularitygs/gutters/_add.scss +10 -0
- data/stylesheets/singularitygs/gutters/_find.scss +17 -0
- data/stylesheets/singularitygs/helpers/_background-grid.scss +186 -0
- data/stylesheets/singularitygs/helpers/_box-sizing.scss +25 -0
- data/stylesheets/singularitygs/helpers/_clearfix.scss +51 -0
- data/stylesheets/singularitygs/helpers/_columns.scss +15 -0
- data/stylesheets/singularitygs/helpers/_directions.scss +37 -0
- data/stylesheets/singularitygs/helpers/_find.scss +75 -0
- data/stylesheets/singularitygs/helpers/_sass-lists.scss +71 -0
- data/stylesheets/singularitygs/helpers/_span-shared.scss +9 -0
- data/stylesheets/singularitygs/language/_parse-add.scss +19 -0
- data/stylesheets/singularitygs/language/_parse-list.scss +53 -0
- data/stylesheets/singularitygs/language/_span.scss +20 -0
- data/stylesheets/singularitygs/math/_columns.scss +70 -0
- data/stylesheets/singularitygs/math/_context.scss +3 -0
- data/stylesheets/singularitygs/math/_gutters.scss +11 -0
- data/templates/{project → box-sizing}/behaviors/box-sizing/boxsizing.htc +0 -0
- data/templates/{project → box-sizing}/behaviors/box-sizing/boxsizing.php +0 -0
- data/templates/box-sizing/manifest.rb +4 -0
- data/templates/project/grid.js +16 -0
- data/templates/project/grid.min.js +2 -0
- data/templates/project/manifest.rb +21 -2
- data/templates/project/partials/_base.scss +4 -0
- data/templates/project/style.scss +15 -0
- metadata +39 -52
- data/stylesheets/singularitygs/_background-grid.scss +0 -49
- data/stylesheets/singularitygs/_column.scss +0 -51
- data/stylesheets/singularitygs/_grid-plugins.scss +0 -4
- data/stylesheets/singularitygs/_grid-structure.scss +0 -14
- data/stylesheets/singularitygs/_grid-test.scss +0 -58
- data/stylesheets/singularitygs/_grid.scss +0 -6
- data/stylesheets/singularitygs/_gutter.scss +0 -45
- data/stylesheets/singularitygs/_mixins.scss +0 -7
- data/stylesheets/singularitygs/grid-plugins/_compound.scss +0 -49
- data/stylesheets/singularitygs/grid-plugins/_gridset.scss +0 -16
- data/stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss +0 -42
- data/stylesheets/singularitygs/grid-plugins/_ratio.scss +0 -24
- data/stylesheets/singularitygs/grid-structure/_display-table.scss +0 -1
- data/stylesheets/singularitygs/grid-structure/_flexbox.scss +0 -0
- data/stylesheets/singularitygs/grid-structure/_float.scss +0 -98
- data/stylesheets/singularitygs/grid-structure/_grid-layout.scss +0 -1
- data/stylesheets/singularitygs/grid-structure/_isolation.scss +0 -154
- data/stylesheets/singularitygs/helpers/_alphabet.scss +0 -1
- data/stylesheets/singularitygs/helpers/_grids.scss +0 -34
- data/stylesheets/singularitygs/helpers/_gridsets.scss +0 -388
- data/stylesheets/singularitygs/helpers/_lists.scss +0 -29
- data/stylesheets/singularitygs/mixins/_base-font-size.scss +0 -63
- data/stylesheets/singularitygs/mixins/_container.scss +0 -63
- data/stylesheets/singularitygs/mixins/_grid-build.scss +0 -9
- data/stylesheets/singularitygs/mixins/_grid-objects.scss +0 -28
- data/stylesheets/singularitygs/mixins/_grid-padding.scss +0 -8
- data/stylesheets/singularitygs/mixins/_grid-span.scss +0 -34
- data/stylesheets/singularitygs/mixins/_push-pull.scss +0 -41
data/lib/singularitygs.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require 'compass'
|
2
|
-
require 'modular-scale'
|
3
2
|
require 'breakpoint'
|
4
3
|
|
5
4
|
Compass::Frameworks.register("singularitygs", :path => "#{File.dirname(__FILE__)}/..")
|
6
5
|
|
7
6
|
module SingularityGS
|
8
|
-
VERSION = "1.0.
|
9
|
-
DATE = "
|
7
|
+
VERSION = "1.0.0"
|
8
|
+
DATE = "2013-04-01"
|
10
9
|
end
|
@@ -1,68 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
//////////////////////////////
|
2
|
+
// Import Required Extensions
|
3
|
+
//////////////////////////////
|
4
4
|
@import "breakpoint";
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
//////////////////////////////
|
7
|
+
// Default Variables
|
8
|
+
//////////////////////////////
|
8
9
|
|
9
|
-
//
|
10
|
-
$columns: 12 !default;
|
11
|
-
|
12
|
-
// Must be of the same unit type of defined columns
|
13
|
-
$gutter: .25 !default;
|
14
|
-
|
15
|
-
// Grid padding can be any type of unit
|
16
|
-
$padding: 0 !default;
|
17
|
-
|
18
|
-
// Layout direction?
|
19
|
-
// options are ltr, rtl, both
|
20
|
-
$dir: ltr !default;
|
21
|
-
|
22
|
-
// Choose a selector for rtl layouts when using 'both'
|
23
|
-
$rtl-selector: '[dir="rtl"]' !default;
|
24
|
-
|
25
|
-
// Options for Multiple Grids
|
10
|
+
// The grids being used
|
26
11
|
$grids: () !default;
|
27
|
-
$gutters: () !default;
|
28
|
-
$paddings: () !default;
|
29
|
-
|
30
|
-
$grids-mobile-first: true !default;
|
31
12
|
|
32
|
-
//
|
33
|
-
$
|
34
|
-
$containers: () !default;
|
35
|
-
$container-to-ems: false !default;
|
13
|
+
// The gutters of the inner columns of the grid
|
14
|
+
$gutters: () !default;
|
36
15
|
|
37
|
-
//
|
38
|
-
$
|
16
|
+
// Specifies whether or not you're building mobile-first grids. Defaults to true
|
17
|
+
$mobile-first: true;
|
39
18
|
|
40
|
-
//
|
41
|
-
$output: '
|
19
|
+
// Default output style.
|
20
|
+
$output: 'float' !default;
|
42
21
|
|
22
|
+
// Direction for your grid. Can be ltr, rtl, or both
|
23
|
+
$direction: 'ltr' !default;
|
43
24
|
|
44
|
-
|
25
|
+
// Whether or not to include border-box or clearfix with all spans
|
26
|
+
$include-border-box: false !default;
|
27
|
+
$include-clearfix: false !default;
|
45
28
|
|
46
|
-
|
29
|
+
//////////////////////////////
|
30
|
+
// Import General Helpers
|
31
|
+
//////////////////////////////
|
47
32
|
@import "singularitygs/helpers";
|
48
33
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
//
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
@import "singularitygs/
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
34
|
+
//////////////////////////////
|
35
|
+
// Import Language Helpers
|
36
|
+
//////////////////////////////
|
37
|
+
@import "singularitygs/language";
|
38
|
+
|
39
|
+
//////////////////////////////
|
40
|
+
// Import Math
|
41
|
+
//////////////////////////////
|
42
|
+
@import "singularitygs/math";
|
43
|
+
|
44
|
+
//////////////////////////////
|
45
|
+
// Import Grid Helpers
|
46
|
+
//////////////////////////////
|
47
|
+
@import "singularitygs/grids";
|
48
|
+
|
49
|
+
//////////////////////////////
|
50
|
+
// Import Gutters Helpers
|
51
|
+
//////////////////////////////
|
52
|
+
@import "singularitygs/gutters";
|
53
|
+
|
54
|
+
//////////////////////////////
|
55
|
+
// Import APIs
|
56
|
+
//////////////////////////////
|
57
|
+
@import "singularitygs/api";
|
@@ -0,0 +1,39 @@
|
|
1
|
+
@mixin grid-span($span, $location, $context: false, $gutter: false, $output-style: $output, $options: false) {
|
2
|
+
|
3
|
+
@if $output-style == 'float' {
|
4
|
+
@include output-float($span, $location, $context, $gutter, $options);
|
5
|
+
}
|
6
|
+
@else if $output-style == 'isolation' {
|
7
|
+
@include output-isolation($span, $location, $context, $gutter, $options);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
@mixin push($span, $location, $context: false, $gutter: false, $output-style: $output) {
|
12
|
+
|
13
|
+
@if $output-style == 'float' {
|
14
|
+
@include push-float($span, $location, $context, $gutter);
|
15
|
+
}
|
16
|
+
@else if $output-style == 'isolation' {
|
17
|
+
@include push-isolation($span, $location, $context, $gutter);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
@mixin pull($span, $location, $context: false, $gutter: false, $output-style: $output) {
|
22
|
+
|
23
|
+
@if $output-style == 'float' {
|
24
|
+
@include pull-float($span, $location, $context, $gutter);
|
25
|
+
}
|
26
|
+
@else if $output-style == 'isolation' {
|
27
|
+
@include pull-isolation($span, $location, $context, $gutter);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
@mixin isolate($span, $location, $context: false, $gutter: false, $output-style: $output) {
|
32
|
+
|
33
|
+
@if $output-style == 'float' {
|
34
|
+
@include isolate-float($span, $location, $context, $gutter);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
@import "api/float";
|
39
|
+
@import "api/isolation";
|
@@ -1,3 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
//////////////////////////////
|
2
|
+
// Code Helpers
|
3
|
+
//////////////////////////////
|
4
|
+
@import "helpers/find";
|
5
|
+
@import "helpers/sass-lists";
|
6
|
+
@import "helpers/columns";
|
7
|
+
@import "helpers/clearfix";
|
8
|
+
@import "helpers/box-sizing";
|
9
|
+
@import "helpers/span-shared";
|
10
|
+
@import "helpers/directions";
|
11
|
+
|
12
|
+
//////////////////////////////
|
13
|
+
// UI Helpers
|
14
|
+
//////////////////////////////
|
15
|
+
@import "helpers/background-grid";
|
@@ -0,0 +1,93 @@
|
|
1
|
+
@mixin output-float($span, $location, $columns, $gutter, $options: false) {
|
2
|
+
|
3
|
+
$location-holder: $location;
|
4
|
+
|
5
|
+
@if type-of($location) == string {
|
6
|
+
@if end-row($span, $location, $columns) {
|
7
|
+
$grid-length: length(find-grid($columns));
|
8
|
+
$location-holder: $grid-length - $span;
|
9
|
+
}
|
10
|
+
@else {
|
11
|
+
$location-holder: 1;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
$gutter: find-gutter($gutter);
|
16
|
+
$end-row: end-row($span, $location, $columns);
|
17
|
+
|
18
|
+
width: column-span($span, $location-holder, $columns, $gutter);
|
19
|
+
|
20
|
+
@if $direction == 'ltr' or $direction == 'both' {
|
21
|
+
// Set the CSS direction to ltr
|
22
|
+
$cssdir: 'ltr';
|
23
|
+
// Find the CSS named direction and opposite direction
|
24
|
+
$dir: named-direction($cssdir);
|
25
|
+
$opp: opposite-direction($dir);
|
26
|
+
|
27
|
+
clear: $opp;
|
28
|
+
|
29
|
+
@if $end-row {
|
30
|
+
float: $opp;
|
31
|
+
}
|
32
|
+
@else {
|
33
|
+
float: $dir;
|
34
|
+
margin-#{$opp}: gutter-span($gutter, $columns);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
@if $direction == 'rtl' or $direction == 'both' {
|
39
|
+
// Set the CSS direction to ltr
|
40
|
+
$cssdir: 'rtl';
|
41
|
+
// Find the CSS named direction and opposite direction
|
42
|
+
$dir: named-direction($cssdir);
|
43
|
+
$opp: opposite-direction($dir);
|
44
|
+
|
45
|
+
|
46
|
+
[dir="#{$cssdir}"] & {
|
47
|
+
clear: $opp;
|
48
|
+
|
49
|
+
@if $end-row {
|
50
|
+
float: $opp;
|
51
|
+
}
|
52
|
+
@else {
|
53
|
+
float: $dir;
|
54
|
+
margin-#{$dir}: 0;
|
55
|
+
margin-#{$opp}: gutter-span($gutter, $columns);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
@include span-shared;
|
61
|
+
}
|
62
|
+
|
63
|
+
@mixin push-float($span, $location, $columns: false, $gutter: false) {
|
64
|
+
|
65
|
+
@if type-of($location) == string {
|
66
|
+
$location: 1;
|
67
|
+
}
|
68
|
+
|
69
|
+
// Find the columns and gutters
|
70
|
+
$columns: find-grid($columns);
|
71
|
+
$gutter: find-gutter($gutter);
|
72
|
+
|
73
|
+
// Combine the columns and gutters
|
74
|
+
$gutter: column-span($span, $location, $columns, $gutter) + gutter-span($gutter, $columns);
|
75
|
+
|
76
|
+
margin-left: $gutter;
|
77
|
+
}
|
78
|
+
|
79
|
+
@mixin pull-float($span, $location, $columns: false, $gutter: false) {
|
80
|
+
|
81
|
+
@if type-of($location) == string {
|
82
|
+
$location: 1;
|
83
|
+
}
|
84
|
+
|
85
|
+
// Find the columns and gutters
|
86
|
+
$columns: find-grid($columns);
|
87
|
+
$gutter: find-gutter($gutter);
|
88
|
+
|
89
|
+
// Combine the columns and gutters
|
90
|
+
$gutter: (column-span($span, $location, $columns, $gutter) + gutter-span($gutter, $columns)) * -1;
|
91
|
+
|
92
|
+
margin-left: $gutter;
|
93
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
@mixin output-isolation($span, $location, $columns, $gutter, $options: false) {
|
2
|
+
|
3
|
+
@if $options == false {
|
4
|
+
$options: 'right';
|
5
|
+
}
|
6
|
+
|
7
|
+
$gutter: find-gutter($gutter);
|
8
|
+
|
9
|
+
@if $direction == 'ltr' or $direction == 'both' {
|
10
|
+
// Set the CSS direction to ltr
|
11
|
+
$cssdir: 'ltr';
|
12
|
+
// Find the CSS named direction and opposite direction
|
13
|
+
$dir: named-direction($cssdir);
|
14
|
+
$opp: opposite-direction($dir);
|
15
|
+
|
16
|
+
width: column-span($span, $location, $columns);
|
17
|
+
margin-#{$dir}: column-span($location - 1, 1, $columns);
|
18
|
+
margin-#{$opp}: -100%;
|
19
|
+
float: $dir;
|
20
|
+
clear: unquote($options);
|
21
|
+
}
|
22
|
+
|
23
|
+
@if $direction == 'rtl' or $direction == 'both' {
|
24
|
+
// Set the CSS direction to ltr
|
25
|
+
$cssdir: 'rtl';
|
26
|
+
// Find the CSS named direction and opposite direction
|
27
|
+
$dir: named-direction($cssdir);
|
28
|
+
$opp: opposite-direction($dir);
|
29
|
+
|
30
|
+
[dir="#{$cssdir}"] & {
|
31
|
+
margin-#{$dir}: column-span($location - 1, 1, $columns) + gutter-span($gutter, $columns);
|
32
|
+
margin-#{$opp}: -100%;
|
33
|
+
float: $dir;
|
34
|
+
clear: unquote($options);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
@include span-shared;
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
@mixin push-isolation($span, $location, $columns: false, $gutter: false) {
|
43
|
+
@include push-float($span, $location, $columns, $gutter);
|
44
|
+
}
|
45
|
+
|
46
|
+
@mixin pull-isolation($span, $location, $columns: false, $gutter: false) {
|
47
|
+
@include pull-float($span, $location, $columns, $gutter);
|
48
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//////////////////////////////
|
2
|
+
// Find Grid
|
3
|
+
//
|
4
|
+
// Finds the grid that you are on.
|
5
|
+
// From Singularity
|
6
|
+
// Must be using Breakpoint to work properly
|
7
|
+
//////////////////////////////
|
8
|
+
@function find-grid($user-columns: false) {
|
9
|
+
|
10
|
+
// We supply a default if the user hasn't set any grids and hasn't passed in a custom column set
|
11
|
+
// The default supplied is based on original Susy options
|
12
|
+
@if length($grids) == 0 and $user-columns == false {
|
13
|
+
$user-columns: 12;
|
14
|
+
}
|
15
|
+
|
16
|
+
@return find-object($grids, $user-columns);
|
17
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
@function add-gutter($gutter-definition) {
|
2
|
+
$parsed: parse-add($gutter-definition);
|
3
|
+
|
4
|
+
@if nth($parsed, 2) == false and length($gutters) == 0 {
|
5
|
+
@return nth($parsed, 1);
|
6
|
+
}
|
7
|
+
@else {
|
8
|
+
@return append($gutters, (nth($parsed, 1) nth($parsed, 2)), 'comma');
|
9
|
+
}
|
10
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//////////////////////////////
|
2
|
+
// Find gutter
|
3
|
+
//
|
4
|
+
// Finds the gutter that you are on.
|
5
|
+
// From Singularity
|
6
|
+
// Must be using Breakpoint to work properly
|
7
|
+
//////////////////////////////
|
8
|
+
@function find-gutter($user-gutter: false) {
|
9
|
+
|
10
|
+
// We supply a default if the user hasn't set any gutters and hasn't passed in a custom gutter
|
11
|
+
// The default supplied is based on original Susy options
|
12
|
+
@if length($gutters) == 0 and $user-gutter == false {
|
13
|
+
$user-gutter: .25;
|
14
|
+
}
|
15
|
+
|
16
|
+
@return find-object($gutters, $user-gutter);
|
17
|
+
}
|
@@ -0,0 +1,186 @@
|
|
1
|
+
// -----------------------------------------------
|
2
|
+
// Grid Overlay & Background
|
3
|
+
//
|
4
|
+
// Uses all your settings to create a grid background for a container element.
|
5
|
+
// There are three ways you can display a grid:
|
6
|
+
//
|
7
|
+
// 1. Manually apply the background to the element -
|
8
|
+
//
|
9
|
+
// .container {
|
10
|
+
// @include background-grid;
|
11
|
+
// }
|
12
|
+
//
|
13
|
+
// 2. Add a switch to toggle an overlay -
|
14
|
+
//
|
15
|
+
// @include grid-overlay('.container');
|
16
|
+
//
|
17
|
+
// 3. Toggle grid with JavaScript
|
18
|
+
//
|
19
|
+
// @include grid-toggle;
|
20
|
+
// Add [data-development-grid="show"] to item you want grid applied to
|
21
|
+
// Add "grid.min.js" to your HTML
|
22
|
+
//
|
23
|
+
// The first will apply a grid background to your container calculated using your
|
24
|
+
// grid settings, media breakpoints etc.
|
25
|
+
//
|
26
|
+
// The second will add a switch to your page which allows you to view a grid
|
27
|
+
// overlay over your container (or <body> if none is provided) by hovering over
|
28
|
+
// the switch. if you need your mouse for other things you can toggle the overlay
|
29
|
+
// on permanently by inspecting <head> and checking :hover in your styles panel.
|
30
|
+
//
|
31
|
+
// The thid will allow you to toggle your background grid on and off by pressing the 'g' on your keyboard.
|
32
|
+
//
|
33
|
+
// Note: Sub-pixel rounding can lead to several pixels of variation between browsers.
|
34
|
+
|
35
|
+
|
36
|
+
// -----------------------------------------------
|
37
|
+
// Imports
|
38
|
+
@import "compass/css3";
|
39
|
+
|
40
|
+
// -----------------------------------------------
|
41
|
+
// Grid Overlay
|
42
|
+
|
43
|
+
// The overlay is painted over your container's ::after pseudo-element, so we must
|
44
|
+
// give position to the container itself, if relative doesn't suit your layout
|
45
|
+
// it can be replaced by absolute/fixed.
|
46
|
+
$overlay-position: relative !default;
|
47
|
+
|
48
|
+
// Set the position of the switch.
|
49
|
+
$overlay-switch-position: left bottom !default;
|
50
|
+
|
51
|
+
@mixin grid-overlay (
|
52
|
+
$selector: 'body',
|
53
|
+
$columns: false,
|
54
|
+
$gutter: false,
|
55
|
+
$color: rgba(Chocolate, .5)
|
56
|
+
) {
|
57
|
+
|
58
|
+
$vert: nth($overlay-switch-position, 1);
|
59
|
+
$horz: nth($overlay-switch-position, 2);
|
60
|
+
|
61
|
+
head {
|
62
|
+
display: block;
|
63
|
+
position: fixed;
|
64
|
+
#{$horz}: 10px;
|
65
|
+
#{$vert}: 10px;
|
66
|
+
z-index: 99;
|
67
|
+
color: #333;
|
68
|
+
text-shadow: 0 0 3px #fff;
|
69
|
+
@include transition(all .4s);
|
70
|
+
&::before {
|
71
|
+
content: "||||";
|
72
|
+
display: block;
|
73
|
+
padding: 10px 14px;
|
74
|
+
letter-spacing: -1;
|
75
|
+
font: {
|
76
|
+
family: sans-serif;
|
77
|
+
size: 26px;
|
78
|
+
weight: bold;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
&:hover {
|
82
|
+
color: #333;
|
83
|
+
text-shadow: 1px 1px #fff;
|
84
|
+
~ body #{$selector} {
|
85
|
+
position: unquote($overlay-position);
|
86
|
+
}
|
87
|
+
~ #{$selector}::after,
|
88
|
+
~ body #{$selector}::after {
|
89
|
+
content: " ";
|
90
|
+
position: absolute;
|
91
|
+
top: 0;
|
92
|
+
left: 0;
|
93
|
+
right: 0;
|
94
|
+
bottom: 0;
|
95
|
+
height: 100%;
|
96
|
+
width: 100%;
|
97
|
+
@include background-grid($columns, $gutter, $color);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
// -----------------------------------------------
|
104
|
+
// Grid Toggle
|
105
|
+
|
106
|
+
@mixin grid-toggle(
|
107
|
+
$columns: false,
|
108
|
+
$gutter: false,
|
109
|
+
$color: rgba(Chocolate, .5)
|
110
|
+
) {
|
111
|
+
|
112
|
+
[data-development-grid="show"] {
|
113
|
+
@include background-grid;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
// -----------------------------------------------
|
118
|
+
// Grid Background
|
119
|
+
|
120
|
+
@mixin background-grid(
|
121
|
+
$columns: false,
|
122
|
+
$gutter: false,
|
123
|
+
$color: rgba(Chocolate, .5)
|
124
|
+
) {
|
125
|
+
|
126
|
+
$background-length: length($grids);
|
127
|
+
|
128
|
+
@if not ($columns) {
|
129
|
+
@for $i from 1 through $background-length {
|
130
|
+
@if $i == 1 {
|
131
|
+
@include background-build($columns, $gutter, $color);
|
132
|
+
}
|
133
|
+
@else {
|
134
|
+
$mq: nth(nth($grids, $i), 2);
|
135
|
+
|
136
|
+
$grid: nth(nth($grids, $i), 1);
|
137
|
+
@include breakpoint($mq) {
|
138
|
+
@include background-build($grid, $gutter, $color);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
@mixin background-build($columns, $gutter, $color) {
|
146
|
+
$columns: find-grid($columns);
|
147
|
+
$gutter: find-gutter($gutter);
|
148
|
+
|
149
|
+
$stops: background-gradient-stops($columns, $gutter, $color);
|
150
|
+
|
151
|
+
@include background(
|
152
|
+
linear-gradient(
|
153
|
+
left, $stops
|
154
|
+
)
|
155
|
+
);
|
156
|
+
}
|
157
|
+
|
158
|
+
//////////////////////////////
|
159
|
+
// Get the stops of the gradient
|
160
|
+
//////////////////////////////
|
161
|
+
@function background-gradient-stops($columns, $gutter, $color) {
|
162
|
+
$bkg: ();
|
163
|
+
$count: column-count($columns);
|
164
|
+
|
165
|
+
@for $i from 1 through column-count($columns) {
|
166
|
+
$bkg: join($bkg, background-column-gradient($i, $columns, $gutter, $color), comma);
|
167
|
+
}
|
168
|
+
|
169
|
+
@return $bkg;
|
170
|
+
}
|
171
|
+
|
172
|
+
//////////////////////////////
|
173
|
+
// Get the columns
|
174
|
+
//////////////////////////////
|
175
|
+
@function background-column-gradient($location, $columns, $gutter, $color) {
|
176
|
+
|
177
|
+
@if $location == 1 {
|
178
|
+
@return lighten($color, 5%) 0%, darken($color, 5%) column-span(1, 1, $columns), lighten($color, 30%) column-span(1, 1, $columns);
|
179
|
+
}
|
180
|
+
@if $location == column-count($columns) {
|
181
|
+
@return lighten($color, 30%) column-span($location - 1, 1, $columns) + gutter-span($gutter, $columns), lighten($color, 5%) column-span($location - 1, 1, $columns) + gutter-span($gutter, $columns), darken($color, 5%) 100%;
|
182
|
+
}
|
183
|
+
@if $location > 1 {
|
184
|
+
@return lighten($color, 30%) column-span($location - 1, 1, $columns) + gutter-span($gutter, $columns), lighten($color, 5%) column-span($location - 1, 1, $columns) + gutter-span($gutter, $columns), darken($color, 5%) column-span($location, 1, $columns), lighten($color, 30%) column-span($location, 1, $columns);
|
185
|
+
}
|
186
|
+
}
|