neat-compass 1.0.2
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.
- data/lib/neat-compass.rb +4 -0
- data/stylesheets/neat/_neat-helpers.scss +8 -0
- data/stylesheets/neat/_neat.scss +11 -0
- data/stylesheets/neat/functions/_new-breakpoint.scss +16 -0
- data/stylesheets/neat/functions/_private.scss +63 -0
- data/stylesheets/neat/functions/_px-to-em.scss +3 -0
- data/stylesheets/neat/grid/_global-variables.scss +1 -0
- data/stylesheets/neat/grid/_grid.scss +230 -0
- data/stylesheets/neat/grid/_visual-grid.scss +40 -0
- data/stylesheets/neat/settings/_grid.scss +6 -0
- data/stylesheets/neat/settings/_visual-grid.scss +5 -0
- metadata +103 -0
data/lib/neat-compass.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
@function new-breakpoint($query:$feature $value $columns, $total-columns: $grid-columns) {
|
2
|
+
|
3
|
+
@if length($query) == 1 {
|
4
|
+
$query: $default-feature nth($query, 1) $total-columns;
|
5
|
+
}
|
6
|
+
|
7
|
+
@else if length($query) == 2 or length($query) == 4 {
|
8
|
+
$query: append($query, $total-columns);
|
9
|
+
}
|
10
|
+
|
11
|
+
@if not belongs-to($query, $visual-grid-breakpoints) {
|
12
|
+
$visual-grid-breakpoints: append($visual-grid-breakpoints, $query, comma);
|
13
|
+
}
|
14
|
+
|
15
|
+
@return $query;
|
16
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// Checks if a number is even
|
2
|
+
@function is-even($int) {
|
3
|
+
@if $int%2 == 0 {
|
4
|
+
@return true;
|
5
|
+
}
|
6
|
+
|
7
|
+
@return false;
|
8
|
+
}
|
9
|
+
|
10
|
+
// Checks if an element belongs to a list
|
11
|
+
@function belongs-to($tested-item, $list) {
|
12
|
+
@each $item in $list {
|
13
|
+
@if $item == $tested-item {
|
14
|
+
@return true;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
@return false;
|
19
|
+
}
|
20
|
+
|
21
|
+
// Parses the first argument of span-columns()
|
22
|
+
@function container-span($span: $span) {
|
23
|
+
@if length($span) == 3 {
|
24
|
+
$container-columns: nth($span, 3);
|
25
|
+
@return $container-columns;
|
26
|
+
}
|
27
|
+
|
28
|
+
@else if length($span) == 2 {
|
29
|
+
$container-columns: nth($span, 2);
|
30
|
+
@return $container-columns;
|
31
|
+
}
|
32
|
+
|
33
|
+
@else {
|
34
|
+
@return $grid-columns;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
// Generates a striped background
|
39
|
+
@function gradient-stops($grid-columns, $color: $visual-grid-color) {
|
40
|
+
$transparent: rgba(0,0,0,0);
|
41
|
+
|
42
|
+
$column-width: flex-grid(1, $grid-columns);
|
43
|
+
$gutter-width: flex-gutter($grid-columns);
|
44
|
+
$column-offset: $column-width;
|
45
|
+
|
46
|
+
$values: ($transparent 0, $color 0);
|
47
|
+
|
48
|
+
@for $i from 1 to $grid-columns*2 {
|
49
|
+
@if is-even($i) {
|
50
|
+
$values: append($values, $transparent $column-offset);
|
51
|
+
$values: append($values, $color $column-offset);
|
52
|
+
$column-offset: $column-offset + $column-width;
|
53
|
+
}
|
54
|
+
|
55
|
+
@else {
|
56
|
+
$values: append($values, $color $column-offset);
|
57
|
+
$values: append($values, $transparent $column-offset);
|
58
|
+
$column-offset: $column-offset + $gutter-width;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
@return $values;
|
63
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
$parent-columns: $grid-columns !default;
|
@@ -0,0 +1,230 @@
|
|
1
|
+
@if $border-box-sizing == true {
|
2
|
+
* {
|
3
|
+
@include box-sizing(border-box);
|
4
|
+
}
|
5
|
+
}
|
6
|
+
|
7
|
+
$fg-column: $column;
|
8
|
+
$fg-gutter: $gutter;
|
9
|
+
$fg-max-columns: $grid-columns;
|
10
|
+
$fg-max-width: $max-width;
|
11
|
+
|
12
|
+
// outer wrapper center container
|
13
|
+
@mixin outer-container() {
|
14
|
+
@include clearfix;
|
15
|
+
max-width: $fg-max-width;
|
16
|
+
margin: {
|
17
|
+
left: auto;
|
18
|
+
right: auto;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
// Grid span columns
|
23
|
+
@mixin span-columns($span: $columns of $container-columns, $display: block) {
|
24
|
+
|
25
|
+
$columns: nth($span, 1);
|
26
|
+
$container-columns: container-span($span);
|
27
|
+
|
28
|
+
@if $container-columns != $grid-columns {
|
29
|
+
$parent-columns: $container-columns;
|
30
|
+
}
|
31
|
+
|
32
|
+
@else {
|
33
|
+
$parent-columns: $grid-columns;
|
34
|
+
}
|
35
|
+
|
36
|
+
@if $display == table {
|
37
|
+
display: table-cell;
|
38
|
+
padding-right: flex-gutter($container-columns);
|
39
|
+
width: flex-grid($columns, $container-columns) + flex-gutter($container-columns);
|
40
|
+
|
41
|
+
&:last-child {
|
42
|
+
padding-right: 0;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
@else if $display == inline-block {
|
47
|
+
@include inline-block;
|
48
|
+
margin-right: flex-gutter($container-columns);
|
49
|
+
width: flex-grid($columns, $container-columns);
|
50
|
+
|
51
|
+
&:last-child {
|
52
|
+
margin-right: 0;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
@else {
|
57
|
+
display: block;
|
58
|
+
float: left;
|
59
|
+
margin-right: flex-gutter($container-columns);
|
60
|
+
width: flex-grid($columns, $container-columns);
|
61
|
+
|
62
|
+
&:last-child {
|
63
|
+
margin-right: 0;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
// Clearfix / row container
|
69
|
+
@mixin row($display: block) {
|
70
|
+
@include clearfix;
|
71
|
+
@if $display == table {
|
72
|
+
display: table;
|
73
|
+
}
|
74
|
+
|
75
|
+
@else {
|
76
|
+
display: block;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
// Shift
|
81
|
+
@mixin shift($n-columns: 1) {
|
82
|
+
margin-left: $n-columns * flex-grid(1, $parent-columns) + $n-columns * flex-gutter($parent-columns);
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
// Pad
|
87
|
+
@mixin pad($padding: flex-gutter()) {
|
88
|
+
padding: $padding;
|
89
|
+
}
|
90
|
+
|
91
|
+
// Remove element gutter
|
92
|
+
@mixin omega($display: block, $direction: right) {
|
93
|
+
@if $display == table {
|
94
|
+
padding-#{$direction}: 0;
|
95
|
+
}
|
96
|
+
|
97
|
+
@else {
|
98
|
+
margin-#{$direction}: 0;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
@mixin nth-omega($nth, $display: block, $direction: right) {
|
103
|
+
@if $display == table {
|
104
|
+
&:nth-child(#{$nth}) {
|
105
|
+
padding-#{$direction}: 0;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
@else {
|
110
|
+
&:nth-child(#{$nth}) {
|
111
|
+
margin-#{$direction}: 0;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
// Fill 100% of parent
|
117
|
+
@mixin fill-parent() {
|
118
|
+
width: 100%;
|
119
|
+
|
120
|
+
@if $border-box-sizing == false {
|
121
|
+
@include box-sizing(border-box);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
// Media Queries
|
126
|
+
@mixin media($query:$feature $value $columns, $total-columns: $grid-columns) {
|
127
|
+
|
128
|
+
@if length($query) == 1 {
|
129
|
+
@media screen and ($default-feature: nth($query, 1)) {
|
130
|
+
$default-grid-columns: $grid-columns;
|
131
|
+
$grid-columns: $total-columns;
|
132
|
+
@content;
|
133
|
+
$grid-columns: $default-grid-columns;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
@else if length($query) == 2 {
|
138
|
+
@media screen and (nth($query, 1): nth($query, 2)) {
|
139
|
+
$default-grid-columns: $grid-columns;
|
140
|
+
$grid-columns: $total-columns;
|
141
|
+
@content;
|
142
|
+
$grid-columns: $default-grid-columns;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
@else if length($query) == 3 {
|
147
|
+
@media screen and (nth($query, 1): nth($query, 2)) {
|
148
|
+
$default-grid-columns: $grid-columns;
|
149
|
+
$grid-columns: nth($query, 3);
|
150
|
+
@content;
|
151
|
+
$grid-columns: $default-grid-columns;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
@else if length($query) == 4 {
|
156
|
+
@media screen and (nth($query, 1): nth($query, 2)) and (nth($query, 3): nth($query, 4)) {
|
157
|
+
$default-grid-columns: $grid-columns;
|
158
|
+
$grid-columns: $total-columns;
|
159
|
+
@content;
|
160
|
+
$grid-columns: $default-grid-columns;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
@else if length($query) == 5 {
|
165
|
+
@media screen and (nth($query, 1): nth($query, 2)) and (nth($query, 3): nth($query, 4)) {
|
166
|
+
$default-grid-columns: $grid-columns;
|
167
|
+
$grid-columns: nth($query, 5);
|
168
|
+
@content;
|
169
|
+
$grid-columns: $default-grid-columns;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
@else {
|
174
|
+
@warn "Wrong number of arguments for breakpoint(). Read the documentation for more details.";
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
// Legacy Mixins
|
179
|
+
@mixin breakpoint($query:$feature $value $columns, $total-columns: $grid-columns) {
|
180
|
+
@warn "The breakpoint() mixin was renamed to media() in Neat 1.0. Please update your project with the new syntax before the next version bump.";
|
181
|
+
|
182
|
+
@if length($query) == 1 {
|
183
|
+
@media screen and ($default-feature: nth($query, 1)) {
|
184
|
+
$default-grid-columns: $grid-columns;
|
185
|
+
$grid-columns: $total-columns;
|
186
|
+
@content;
|
187
|
+
$grid-columns: $default-grid-columns;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
@else if length($query) == 2 {
|
192
|
+
@media screen and (nth($query, 1): nth($query, 2)) {
|
193
|
+
$default-grid-columns: $grid-columns;
|
194
|
+
$grid-columns: $total-columns;
|
195
|
+
@content;
|
196
|
+
$grid-columns: $default-grid-columns;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
@else if length($query) == 3 {
|
201
|
+
@media screen and (nth($query, 1): nth($query, 2)) {
|
202
|
+
$default-grid-columns: $grid-columns;
|
203
|
+
$grid-columns: nth($query, 3);
|
204
|
+
@content;
|
205
|
+
$grid-columns: $default-grid-columns;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
@else if length($query) == 4 {
|
210
|
+
@media screen and (nth($query, 1): nth($query, 2)) and (nth($query, 3): nth($query, 4)) {
|
211
|
+
$default-grid-columns: $grid-columns;
|
212
|
+
$grid-columns: $total-columns;
|
213
|
+
@content;
|
214
|
+
$grid-columns: $default-grid-columns;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
@else if length($query) == 5 {
|
219
|
+
@media screen and (nth($query, 1): nth($query, 2)) and (nth($query, 3): nth($query, 4)) {
|
220
|
+
$default-grid-columns: $grid-columns;
|
221
|
+
$grid-columns: nth($query, 5);
|
222
|
+
@content;
|
223
|
+
$grid-columns: $default-grid-columns;
|
224
|
+
}
|
225
|
+
}
|
226
|
+
|
227
|
+
@else {
|
228
|
+
@warn "Wrong number of arguments for breakpoint(). Read the documentation for more details.";
|
229
|
+
}
|
230
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
@mixin grid-column-gradient($values...) {
|
2
|
+
background-image: deprecated-webkit-gradient(linear, left top, left bottom, $values);
|
3
|
+
background-image: -webkit-linear-gradient(left, $values);
|
4
|
+
background-image: -moz-linear-gradient(left, $values);
|
5
|
+
background-image: -ms-linear-gradient(left, $values);
|
6
|
+
background-image: -o-linear-gradient(left, $values);
|
7
|
+
background-image: unquote("linear-gradient(left, #{$values})");
|
8
|
+
}
|
9
|
+
|
10
|
+
@if $visual-grid == true or $visual-grid == yes {
|
11
|
+
body:before {
|
12
|
+
content: '';
|
13
|
+
display: inline-block;
|
14
|
+
@include grid-column-gradient(gradient-stops($grid-columns));
|
15
|
+
height: 100%;
|
16
|
+
left: 0;
|
17
|
+
margin: 0 auto;
|
18
|
+
max-width: $max-width;
|
19
|
+
opacity: $visual-grid-opacity;
|
20
|
+
position: fixed;
|
21
|
+
right: 0;
|
22
|
+
width: 100%;
|
23
|
+
|
24
|
+
@if $visual-grid-index == back {
|
25
|
+
z-index: -1;
|
26
|
+
}
|
27
|
+
|
28
|
+
@else if $visual-grid-index == front {
|
29
|
+
z-index: 9999;
|
30
|
+
}
|
31
|
+
|
32
|
+
@each $breakpoint in $visual-grid-breakpoints {
|
33
|
+
@if $breakpoint != nil {
|
34
|
+
@include media($breakpoint) {
|
35
|
+
@include grid-column-gradient(gradient-stops($grid-columns));
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
$column: golden-ratio(1em, 3) !default; // Column width
|
2
|
+
$gutter: golden-ratio(1em, 1) !default; // Gutter between each two columns
|
3
|
+
$grid-columns: 12 !default; // Total number of columns in the grid
|
4
|
+
$max-width: em(1088) !default; // Max-width of the outer container
|
5
|
+
$border-box-sizing: true !default; // Makes all elements have a border-box layout
|
6
|
+
$default-feature: min-width; // Default @media feature for the breakpoint() mixin
|
@@ -0,0 +1,5 @@
|
|
1
|
+
$visual-grid: false !default; // Display the base grid
|
2
|
+
$visual-grid-color: #EEE !default;
|
3
|
+
$visual-grid-index: back !default; // Show grid behind content (back) or overlay it over the content (front)
|
4
|
+
$visual-grid-opacity: 0.4 !default;
|
5
|
+
$visual-grid-breakpoints: nil !default;
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: neat-compass
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jed Foster
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: compass
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.11'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.11'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bourbon
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.1'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sass
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.2'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
description: ThoughtBot's Neat packaged as a Compass extension.
|
63
|
+
email: jed@jedfoster.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- lib/neat-compass.rb
|
69
|
+
- stylesheets/neat/_neat-helpers.scss
|
70
|
+
- stylesheets/neat/_neat.scss
|
71
|
+
- stylesheets/neat/functions/_new-breakpoint.scss
|
72
|
+
- stylesheets/neat/functions/_private.scss
|
73
|
+
- stylesheets/neat/functions/_px-to-em.scss
|
74
|
+
- stylesheets/neat/grid/_global-variables.scss
|
75
|
+
- stylesheets/neat/grid/_grid.scss
|
76
|
+
- stylesheets/neat/grid/_visual-grid.scss
|
77
|
+
- stylesheets/neat/settings/_grid.scss
|
78
|
+
- stylesheets/neat/settings/_visual-grid.scss
|
79
|
+
homepage: https://github.com/thoughtbot/neat
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.8.23
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: ThoughtBot's Neat packaged as a Compass extension.
|
103
|
+
test_files: []
|