compass-grid-plugin 0.0.3 → 0.0.4
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/README.md +45 -29
- data/compass-grid-plugin.gemspec +3 -3
- data/example/config.rb +26 -27
- data/example/example.html +39 -39
- data/example/fixed.html +215 -215
- data/example/fluid.html +453 -429
- data/example/media.html +66 -66
- data/example/scss/example-fluid.scss +2 -1
- data/example/scss/example.scss +54 -54
- data/example/scss/fluid.scss +23 -7
- data/example/scss/media.scss +329 -329
- data/lib/compass-grid.rb +14 -1
- data/lib/compass/grid.rb +6 -6
- data/lib/compass/grid/version.rb +1 -1
- data/stylesheets/_grid.scss +151 -126
- data/stylesheets/grid/_fluid.scss +49 -28
- data/stylesheets/grid/fluid/_helpers.scss +14 -0
- data/templates/project/manifest.rb +16 -16
- data/templates/project/partials/_base.scss +6 -6
- data/templates/project/screen.scss +9 -9
- metadata +8 -7
data/lib/compass-grid.rb
CHANGED
@@ -2,4 +2,17 @@ require 'compass' # Ensure Compass
|
|
2
2
|
require 'compass/grid'
|
3
3
|
|
4
4
|
# Ensure maximum useful precision
|
5
|
-
Sass::Script::Number.precision = 7
|
5
|
+
Sass::Script::Number.precision = 7
|
6
|
+
|
7
|
+
module Sass::Script::Functions
|
8
|
+
def precision(*args)
|
9
|
+
if !args[0].nil?
|
10
|
+
precision = args[0]
|
11
|
+
assert_type precision, :Number
|
12
|
+
Sass::Script::Number.precision = precision.value
|
13
|
+
end
|
14
|
+
Sass::Script::Number.new(Sass::Script::Number.precision)
|
15
|
+
end
|
16
|
+
|
17
|
+
declare :precision, :args => [:number]
|
18
|
+
end
|
data/lib/compass/grid.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'compass/grid/version'
|
2
|
-
|
3
|
-
module Compass
|
4
|
-
module Grid
|
5
|
-
Compass::Frameworks.register('compass-grid', :path => "#{File.dirname(__FILE__)}/../..")
|
6
|
-
end
|
1
|
+
require 'compass/grid/version'
|
2
|
+
|
3
|
+
module Compass
|
4
|
+
module Grid
|
5
|
+
Compass::Frameworks.register('compass-grid', :path => "#{File.dirname(__FILE__)}/../..")
|
6
|
+
end
|
7
7
|
end
|
data/lib/compass/grid/version.rb
CHANGED
data/stylesheets/_grid.scss
CHANGED
@@ -1,127 +1,152 @@
|
|
1
|
-
// Compass Clearfix
|
2
|
-
@import "compass/utilities/general/clearfix";
|
3
|
-
|
4
|
-
//-----------------------------------
|
5
|
-
// Defaults
|
6
|
-
//-----------------------------------
|
7
|
-
$grid-column-width: 60px !default;
|
8
|
-
$grid-gutter-width: 20px !default;
|
9
|
-
$grid-columns: 12 !default;
|
10
|
-
|
11
|
-
// apply fixes for IE6
|
12
|
-
//$grid-extend-clearfix: true !default;
|
13
|
-
$grid-clearfix-class: true !default;
|
14
|
-
$grid-support-for-ie6: false !default;
|
15
|
-
|
16
|
-
@if $grid-clearfix-class {
|
17
|
-
.clearfix {
|
18
|
-
@if $grid-clearfix-class == clearfix {
|
19
|
-
@include clearfix;
|
20
|
-
} @else if $grid-clearfix-class == legacy-pie-clearfix {
|
21
|
-
@include legacy-pie-clearfix;
|
22
|
-
} @else {
|
23
|
-
@include pie-clearfix;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
//-----------------------------------
|
29
|
-
// Column Widths
|
30
|
-
//-----------------------------------
|
31
|
-
|
32
|
-
// apply a width to a column
|
33
|
-
@mixin grid($i, $plus: 0) {
|
34
|
-
width: grid-column-width($i, $plus);
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
width
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
//-----------------------------------
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
margin: 0
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
@
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
1
|
+
// Compass Clearfix
|
2
|
+
@import "compass/utilities/general/clearfix";
|
3
|
+
|
4
|
+
//-----------------------------------
|
5
|
+
// Defaults
|
6
|
+
//-----------------------------------
|
7
|
+
$grid-column-width: 60px !default;
|
8
|
+
$grid-gutter-width: 20px !default;
|
9
|
+
$grid-columns: 12 !default;
|
10
|
+
|
11
|
+
// apply fixes for IE6
|
12
|
+
//$grid-extend-clearfix: true !default;
|
13
|
+
$grid-clearfix-class: true !default;
|
14
|
+
$grid-support-for-ie6: false !default;
|
15
|
+
|
16
|
+
@if $grid-clearfix-class {
|
17
|
+
.clearfix {
|
18
|
+
@if $grid-clearfix-class == clearfix {
|
19
|
+
@include clearfix;
|
20
|
+
} @else if $grid-clearfix-class == legacy-pie-clearfix {
|
21
|
+
@include legacy-pie-clearfix;
|
22
|
+
} @else {
|
23
|
+
@include pie-clearfix;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
//-----------------------------------
|
29
|
+
// Column Widths
|
30
|
+
//-----------------------------------
|
31
|
+
|
32
|
+
// apply a width to a column
|
33
|
+
@mixin grid($i, $plus: 0, $with-gutters: false) {
|
34
|
+
width: grid-column-width($i, $plus);
|
35
|
+
@if $with-gutters { @include grid-column-gutters; }
|
36
|
+
}
|
37
|
+
|
38
|
+
// apply standard gutters to a column or row
|
39
|
+
@mixin grid-gutters($row: false) {
|
40
|
+
margin: 0 grid-gutter-width($row);
|
41
|
+
}
|
42
|
+
@mixin grid-row-gutters() {
|
43
|
+
@include grid-gutters(true);
|
44
|
+
}
|
45
|
+
@mixin grid-column-gutters() {
|
46
|
+
@include grid-gutters(false);
|
47
|
+
}
|
48
|
+
|
49
|
+
// return a column width in pixels
|
50
|
+
@function grid-column-width($i, $plus: 0) {
|
51
|
+
@return $grid-column-width * $i + $grid-gutter-width * ($i - 1) + $plus;
|
52
|
+
}
|
53
|
+
|
54
|
+
// return a row width in pixels
|
55
|
+
@function grid-row-width($i, $plus: 0) {
|
56
|
+
@return grid-column-width($i, $plus + $grid-gutter-width);
|
57
|
+
}
|
58
|
+
|
59
|
+
// return a gutter width in pixels
|
60
|
+
@function grid-gutter-width($row: false) {
|
61
|
+
@return ($grid-gutter-width / 2 * if($row, -1, 1));
|
62
|
+
}
|
63
|
+
|
64
|
+
//-----------------------------------
|
65
|
+
// Containers
|
66
|
+
//-----------------------------------
|
67
|
+
|
68
|
+
// specify a container as a page
|
69
|
+
@mixin grid-page($i: $grid-columns, $plus: 0) {
|
70
|
+
@extend .clearfix;
|
71
|
+
width: grid-row-width($i, $plus);
|
72
|
+
margin: 0 auto;
|
73
|
+
}
|
74
|
+
|
75
|
+
// specify a container as a row
|
76
|
+
@mixin grid-row($page: false) {
|
77
|
+
@extend .clearfix;
|
78
|
+
width: auto;
|
79
|
+
|
80
|
+
// rows directly inside a page don't need the negative margin
|
81
|
+
@if $page {
|
82
|
+
margin: 0 0;
|
83
|
+
} @else {
|
84
|
+
@include grid-row-gutters;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
//-----------------------------------
|
89
|
+
// Columns
|
90
|
+
//-----------------------------------
|
91
|
+
|
92
|
+
// specify a column
|
93
|
+
@mixin grid-column($i: false, $plus: 0, $with-gutters: true) {
|
94
|
+
float: left;
|
95
|
+
@if $grid-support-for-ie6 { _display: inline; }
|
96
|
+
@if $with-gutters { @include grid-column-gutters; }
|
97
|
+
|
98
|
+
// apply a width
|
99
|
+
@if $i { @include grid($i, $plus); }
|
100
|
+
}
|
101
|
+
|
102
|
+
// alter the margins of a column
|
103
|
+
@mixin grid-offset($i: 1, $plus: 0, $side: left) {
|
104
|
+
margin-#{$side}: (grid-column-width($i, $grid-gutter-width + $plus) + ($grid-gutter-width/2));
|
105
|
+
}
|
106
|
+
|
107
|
+
// convenience mixin for left offsets
|
108
|
+
@mixin grid-offset-left($i: 1, $plus: 0) {
|
109
|
+
@include grid-offset($i, $plus, left);
|
110
|
+
}
|
111
|
+
|
112
|
+
// convenience mixin for right offsets
|
113
|
+
@mixin grid-offset-right($i: 1, $plus: 0) {
|
114
|
+
@include grid-offset($i, $plus, right);
|
115
|
+
}
|
116
|
+
|
117
|
+
//-----------------------------------
|
118
|
+
// Default Styles
|
119
|
+
//-----------------------------------
|
120
|
+
@mixin grid-css() {
|
121
|
+
// containers
|
122
|
+
.page {
|
123
|
+
@include grid-page;
|
124
|
+
}
|
125
|
+
.row {
|
126
|
+
@include grid-row;
|
127
|
+
}
|
128
|
+
.page > .row {
|
129
|
+
@include grid-row(true);
|
130
|
+
}
|
131
|
+
|
132
|
+
// columns
|
133
|
+
.column {
|
134
|
+
@include grid-column;
|
135
|
+
}
|
136
|
+
|
137
|
+
@for $i from 1 through $grid-columns {
|
138
|
+
// columns widths
|
139
|
+
.grid-#{$i} { width: grid-column-width($i); }
|
140
|
+
|
141
|
+
// alter left and right margins
|
142
|
+
@if $i < $grid-columns {
|
143
|
+
.before-#{$i} { @include grid-offset-left($i); }
|
144
|
+
.after-#{$i} { @include grid-offset-right($i); }
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
// Box
|
149
|
+
.box {
|
150
|
+
margin-bottom: $grid-gutter-width;
|
151
|
+
}
|
127
152
|
}
|
@@ -2,40 +2,59 @@
|
|
2
2
|
@import "compass/css3/box-sizing";
|
3
3
|
|
4
4
|
// Ensure grid is included
|
5
|
-
@import "grid";
|
5
|
+
@import "../../stylesheets/grid";
|
6
|
+
@import "../../stylesheets/grid/fluid/helpers";
|
6
7
|
|
7
8
|
//-----------------------------------
|
8
9
|
// Defaults
|
9
10
|
//-----------------------------------
|
11
|
+
$fluid-support-for-ie7: false !default;
|
10
12
|
|
11
13
|
//-----------------------------------
|
12
14
|
// Column Widths
|
13
15
|
//-----------------------------------
|
14
16
|
|
15
17
|
// apply a width to a column
|
16
|
-
@mixin fluid($i, $plus: 0, $
|
17
|
-
width: fluid-column-width($i, $plus, $
|
18
|
-
@if $
|
18
|
+
@mixin fluid($i, $plus: 0, $context: $grid-columns, $context-plus: 0, $with-gutters: false) {
|
19
|
+
width: fluid-column-width($i, $plus, $context, $context-plus);
|
20
|
+
@if $fluid-support-for-ie7 {
|
21
|
+
*width: fluid-column-width($i, $plus, $context, $context-plus, $nudge: true);
|
22
|
+
}
|
23
|
+
@if $with-gutters { @include fluid-column-gutters($context, $context-plus); }
|
19
24
|
}
|
20
25
|
|
21
26
|
// apply standard gutters to a column or row
|
22
|
-
@mixin fluid-gutters($
|
23
|
-
margin: 0 fluid-
|
27
|
+
@mixin fluid-gutters($context: $grid-columns, $context-plus: 0, $row: false) {
|
28
|
+
margin: 0 fluid-gutter-width($context, $context-plus, $row);
|
29
|
+
@if $fluid-support-for-ie7 {
|
30
|
+
*margin: 0 fluid-gutter-width($context, $context-plus, $row, $nudge: true);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
@mixin fluid-row-gutters($context: $grid-columns, $context-plus: 0) {
|
34
|
+
@include fluid-gutters($context, $context-plus, true);
|
35
|
+
}
|
36
|
+
@mixin fluid-column-gutters($context: $grid-columns, $context-plus: 0) {
|
37
|
+
@include fluid-gutters($context, $context-plus, false);
|
24
38
|
}
|
25
39
|
|
26
|
-
// return a percentage width relative to a
|
27
|
-
@function fluid-column-width($i, $plus: 0, $
|
28
|
-
@return fluid-width(grid-column-width($i, $plus), grid-
|
40
|
+
// return a percentage column width relative to a row width
|
41
|
+
@function fluid-column-width($i, $plus: 0, $context: $grid-columns, $context-plus: 0, $nudge: false) {
|
42
|
+
@return fluid-width(grid-column-width($i, $plus), grid-row-width($context, $context-plus), $nudge);
|
43
|
+
}
|
44
|
+
|
45
|
+
// return a percentage gutter width relative to a column or row width
|
46
|
+
@function fluid-gutter-width($context: $grid-columns, $context-plus: 0, $row: false, $nudge: false) {
|
47
|
+
@return fluid-width($grid-gutter-width / 2 * if($row, -1, 1), grid-row-width($context, $context-plus + if($row, 0, $grid-gutter-width)), $nudge);
|
29
48
|
}
|
30
49
|
|
31
50
|
// return a percentage width relative to a parent width
|
32
|
-
@function fluid-width($width, $
|
33
|
-
@return percentage($width / $
|
51
|
+
@function fluid-width($width, $context-width: grid-column-width($grid-columns, $grid-gutter-width), $nudge: false) {
|
52
|
+
@return percentage($width / $context-width) + if($nudge, fluid-nudge($context-width), 0);
|
34
53
|
}
|
35
54
|
|
36
55
|
// return a percentage for a half-pixel
|
37
|
-
@function fluid-nudge($
|
38
|
-
@return percentage(
|
56
|
+
@function fluid-nudge($context-width: grid-column-width($grid-columns, $grid-gutter-width)) {
|
57
|
+
@return percentage(-0.5px / $context-width);
|
39
58
|
}
|
40
59
|
|
41
60
|
|
@@ -53,7 +72,7 @@
|
|
53
72
|
}
|
54
73
|
|
55
74
|
// specify a container as a row
|
56
|
-
@mixin fluid-row($page: false, $
|
75
|
+
@mixin fluid-row($page: false, $context: $grid-columns, $context-plus: 0) {
|
57
76
|
@extend .clearfix;
|
58
77
|
@include box-sizing(border-box);
|
59
78
|
width: auto;
|
@@ -62,7 +81,7 @@
|
|
62
81
|
@if $page {
|
63
82
|
margin: 0 0;
|
64
83
|
} @else {
|
65
|
-
@include fluid-gutters($
|
84
|
+
@include fluid-row-gutters($context, $context-plus);
|
66
85
|
}
|
67
86
|
}
|
68
87
|
|
@@ -71,30 +90,32 @@
|
|
71
90
|
//-----------------------------------
|
72
91
|
|
73
92
|
// specify a column
|
74
|
-
@mixin fluid-column($i: false, $plus: 0, $
|
93
|
+
@mixin fluid-column($i: false, $plus: 0, $context: $grid-columns, $context-plus: 0, $with-gutters: true) {
|
75
94
|
@include box-sizing(border-box);
|
76
|
-
@if $with-gutters { @include fluid-gutters($parent, $parent-plus); }
|
77
95
|
float: left;
|
78
|
-
|
79
|
-
@if $
|
96
|
+
@if $grid-support-for-ie6 { _display: inline; }
|
97
|
+
@if $with-gutters { @include fluid-column-gutters($context, $context-plus); }
|
80
98
|
|
81
99
|
// apply a width
|
82
|
-
@if $i { @include fluid($i, $plus, $
|
100
|
+
@if $i { @include fluid($i, $plus, $context, $context-plus); }
|
83
101
|
}
|
84
102
|
|
85
103
|
// alter the margins of a column
|
86
|
-
@mixin fluid-offset($i: 1, $plus: 0, $side: left, $
|
87
|
-
margin-#{$side}: (fluid-column-width($i, $
|
104
|
+
@mixin fluid-offset($i: 1, $plus: 0, $side: left, $context: $grid-columns, $context-plus: 0) {
|
105
|
+
margin-#{$side}: (fluid-column-width($i, $plus) + fluid-gutter-width($context, $context-plus) * 3);
|
106
|
+
@if $fluid-support-for-ie7 {
|
107
|
+
*margin-#{$side}: (fluid-column-width($i, $plus, $context, $context-plus, $nudge: nudge) + fluid-gutter-width($context, $context-plus, $nudge: nudge) * 3);
|
108
|
+
}
|
88
109
|
}
|
89
110
|
|
90
111
|
// convenience mixin for left offsets
|
91
|
-
@mixin fluid-offset-left($i: 1, $plus: 0, $
|
92
|
-
@include fluid-offset($i, $plus, left, $
|
112
|
+
@mixin fluid-offset-left($i: 1, $plus: 0, $context: $grid-columns, $context-plus: 0) {
|
113
|
+
@include fluid-offset($i, $plus, left, $context, $context-plus);
|
93
114
|
}
|
94
115
|
|
95
116
|
// convenience mixin for right offsets
|
96
|
-
@mixin fluid-offset-right($i: 1, $plus: 0, $
|
97
|
-
@include fluid-offset($i, $plus, right, $
|
117
|
+
@mixin fluid-offset-right($i: 1, $plus: 0, $context: $grid-columns, $context-plus: 0) {
|
118
|
+
@include fluid-offset($i, $plus, right, $context, $context-plus);
|
98
119
|
}
|
99
120
|
|
100
121
|
//-----------------------------------
|
@@ -119,8 +140,8 @@
|
|
119
140
|
// columns widths
|
120
141
|
.fluid-#{$i} {
|
121
142
|
width: fluid-column-width($i);
|
122
|
-
> .fluid-row { @include fluid-gutters($i
|
123
|
-
> .fluid-row > .fluid-column { @include fluid-gutters($i); }
|
143
|
+
> .fluid-row { @include fluid-row-gutters($i); }
|
144
|
+
> .fluid-row > .fluid-column { @include fluid-column-gutters($i); }
|
124
145
|
@for $j from 1 through $grid-columns - 1 {
|
125
146
|
@if $j <= $i {
|
126
147
|
> .fluid-row > .fluid-#{$j} { width: fluid-column-width($j, 0, $i); }
|