crispy-grid 0.2.0 → 0.3.0
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 +29 -4
- data/stylesheets/_crispy-grid.sass +10 -4
- data/stylesheets/crispy/_grid.sass +46 -30
- data/templates/project/_crispy-grid.sass +11 -12
- metadata +3 -3
data/README.md
CHANGED
@@ -53,12 +53,37 @@ Pending. Please have a look at the source.
|
|
53
53
|
|
54
54
|
3. Customize and import the grid in your application stylesheet:
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
### Configuration for a Single Device
|
57
|
+
|
58
|
+
The grid configuration is layed out for multiple devices.
|
59
|
+
Though, you can also use Crispy Grid the classic way without any overhead.
|
60
|
+
Just provide one setting and ignore the fact that the variables are
|
61
|
+
written in plural.
|
62
|
+
|
63
|
+
// Copy this into your app in order to customize the grid
|
64
|
+
$devices: desktop
|
65
|
+
$grid-column-widths: 30px
|
66
|
+
$grid-gutter-widths: 10px
|
59
67
|
$grid-columns: 25
|
60
68
|
|
61
|
-
|
69
|
+
// Import Crispy Grid below the configuration
|
70
|
+
@import crispy/grid
|
71
|
+
|
72
|
+
### Configuration for Multiple Devices
|
73
|
+
|
74
|
+
In `$devices` you can list all devices you whish to respond to.
|
75
|
+
The nth entry of any of the following lists belongs to the nth device (the order of `$devices` matters).
|
76
|
+
The first device is the default for all grid helpers.
|
77
|
+
Consider to set mobile as default device when following the mobile-first design approach.
|
78
|
+
|
79
|
+
// Copy this into your app in order to customize the grid
|
80
|
+
$devices: desktop, tablet, handheld-640, handheld-320
|
81
|
+
$grid-column-widths: 30px, 30px, 20px, 20px
|
82
|
+
$grid-gutter-widths: 10px, 10px, 5px, 5px
|
83
|
+
$grid-columns: 30, 25, 25, 13
|
84
|
+
|
85
|
+
// Import Crispy Grid below the configuration
|
86
|
+
@import crispy/grid
|
62
87
|
|
63
88
|
## License
|
64
89
|
|
@@ -1,9 +1,15 @@
|
|
1
1
|
// Crispy Grid Configuration
|
2
2
|
//==========================
|
3
3
|
|
4
|
-
//
|
5
|
-
$
|
6
|
-
|
7
|
-
|
4
|
+
// Configure grid for every device you whish to respond to
|
5
|
+
// The nth entry of any list belongs to the nth device (the order of $devices matters).
|
6
|
+
// The lists can take any number of devices, including 1.
|
7
|
+
// If you do not plan to support multiple devices, you may want to delete all but the first entries.
|
8
|
+
// The first device is the default for all grid helpers.
|
9
|
+
// Consider to set mobile as default device when following the mobile-first design approach.
|
10
|
+
$devices: desktop, tablet, handheld-640, handheld-320 !default
|
11
|
+
$grid-column-widths: 30px, 30px, 20px, 20px !default
|
12
|
+
$grid-gutter-widths: 10px, 10px, 5px, 5px !default
|
13
|
+
$grid-columns: 30, 25, 25, 13 !default
|
8
14
|
|
9
15
|
@import crispy/grid
|
@@ -1,11 +1,27 @@
|
|
1
1
|
@import compass//utilities/general/clearfix
|
2
2
|
|
3
|
-
//
|
4
|
-
|
3
|
+
// Grid Configuration Accessors
|
4
|
+
//=============================
|
5
|
+
@function default-device()
|
6
|
+
@return nth($devices, 1)
|
7
|
+
|
8
|
+
@function grid-column-width($device: default-device())
|
9
|
+
@return nth($grid-column-widths, index($devices, $device))
|
10
|
+
|
11
|
+
@function grid-gutter-width($device: default-device())
|
12
|
+
@return nth($grid-gutter-widths, index($devices, $device))
|
13
|
+
|
14
|
+
@function grid-columns($device: default-device())
|
15
|
+
@return nth($grid-columns, index($devices, $device))
|
16
|
+
|
5
17
|
// Note that the gutter is only between the columns, i.e. you have 1 gutter less than columns
|
6
|
-
|
7
|
-
|
8
|
-
|
18
|
+
@function grid-gutters($device: default-device())
|
19
|
+
@return grid-columns($device) - 1
|
20
|
+
|
21
|
+
// The default settings result in a grid-width of 990 px
|
22
|
+
@function grid-width($device: default-device())
|
23
|
+
@return grid-column-width($device) * grid-columns($device) + grid-gutter-width($device) * grid-gutters($device)
|
24
|
+
|
9
25
|
|
10
26
|
// Public Methods
|
11
27
|
//===============
|
@@ -18,30 +34,30 @@ $grid-width: $grid-column-width * $grid-columns + $grid-gutter-width * $grid-gut
|
|
18
34
|
// In order to differentiate between left and right padding/border-width you can set $different-right-padding/-border-width.
|
19
35
|
// Example: +grid(4, 10px, 15px) will set padding-left: 10px, padding-right: 15px and the element will have the same overall width as +grid(4).
|
20
36
|
// By default, the gutter is represented using margin-right, which can also be overridden.
|
21
|
-
=column($colspan, $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter:
|
37
|
+
=column($colspan, $device: default-device(), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: grid-gutter-width($device), $left-gutter: false, $subtract-border-from: false)
|
22
38
|
+column-behavior
|
23
|
-
+column-metrics($colspan, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from: $subtract-border-from)
|
39
|
+
+column-metrics($colspan, $device, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from: $subtract-border-from)
|
24
40
|
|
25
41
|
// The last column should not have a gutter.
|
26
42
|
// Respectively, $gutter defaults to 0 in this mixin.
|
27
|
-
=last-column($colspan, $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: 0, $left-gutter: false, $subtract-border-from: false)
|
28
|
-
+column($colspan, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from)
|
43
|
+
=last-column($colspan, $device: default-device(), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: 0, $left-gutter: false, $subtract-border-from: false)
|
44
|
+
+column($colspan, $device, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from)
|
29
45
|
|
30
46
|
// The only difference between the last and other columns is that the last column has margin-right set to 0.
|
31
47
|
=last
|
32
48
|
margin-right: 0
|
33
49
|
|
34
50
|
// A row spans the whole grid width, i.e. it is the only column in a row. This is just a more elegant way for writing +last-column($grid-columns).
|
35
|
-
=row($colspan:
|
36
|
-
+last-column($colspan, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from)
|
51
|
+
=row($device: default-device(), $colspan: grid-columns($device), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: 0, $left-gutter: false, $subtract-border-from: false)
|
52
|
+
+last-column($colspan, $device, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $gutter, $left-gutter, $subtract-border-from)
|
37
53
|
|
38
54
|
// Use this mixin for your (none-floating) grid container.
|
39
55
|
// By default, it spans the whole grid-width and is centered.
|
40
56
|
// Unlike with columns, paddings and borders of a container do not affect its inner width.
|
41
57
|
// Clearfixing has to be done in order to enforce the container to enclose its content.
|
42
58
|
// By default, the overflow: hidden method is used. Specify $clearfix: pie if container contents should be visible outside of the container (e.g. when positioned absolutely).
|
43
|
-
=grid-container($colspan:
|
44
|
-
+column-metrics($colspan, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $right-margin, $left-margin, true)
|
59
|
+
=grid-container($device: default-device(), $colspan: grid-columns($device), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $left-margin: auto, $right-margin: auto, $clearfix: overflow)
|
60
|
+
+column-metrics($colspan, $device, $padding, $differing-right-padding, $border-width, $differing-right-border-width, $right-margin, $left-margin, true)
|
45
61
|
@if $clearfix == pie or $clearfix == pie-clearfix
|
46
62
|
+pie-clearfix
|
47
63
|
@else
|
@@ -52,18 +68,18 @@ $grid-width: $grid-column-width * $grid-columns + $grid-gutter-width * $grid-gut
|
|
52
68
|
=column-behavior
|
53
69
|
float: left
|
54
70
|
|
55
|
-
=column-metrics($column-width, $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter:
|
71
|
+
=column-metrics($column-width, $device: default-device(), $padding: 0, $differing-right-padding: false, $border-width: 0, $differing-right-border-width: false, $gutter: grid-gutter-width($device), $left-gutter: false, $container: false, $subtract-border-from: false)
|
56
72
|
// Convert column counts to widths with unit
|
57
|
-
$column-width: colspan-to-width($column-width)
|
58
|
-
$padding: colspan-to-width($padding, $include-last-gutter: true)
|
59
|
-
$differing-right-padding: colspan-to-width($differing-right-padding, $include-last-gutter: true)
|
60
|
-
$border-width: colspan-to-width($border-width, $include-last-gutter: true)
|
61
|
-
$differing-right-border-width: colspan-to-width($differing-right-border-width, $include-last-gutter: true)
|
62
|
-
@if
|
73
|
+
$column-width: colspan-to-width($column-width, $device)
|
74
|
+
$padding: colspan-to-width($padding, $device, $include-last-gutter: true)
|
75
|
+
$differing-right-padding: colspan-to-width($differing-right-padding, $device, $include-last-gutter: true)
|
76
|
+
$border-width: colspan-to-width($border-width, $device, $include-last-gutter: true)
|
77
|
+
$differing-right-border-width: colspan-to-width($differing-right-border-width, $device, $include-last-gutter: true)
|
78
|
+
@if is-column-count($gutter)
|
63
79
|
// It is assumed that the original gutter should also be preserved in addition to the one of the last column
|
64
|
-
$gutter:
|
65
|
-
@if
|
66
|
-
$left-gutter: colspan-to-width($left-gutter, $include-last-gutter: true)
|
80
|
+
$gutter: grid-gutter-width($device) + colspan-to-width($gutter, $device, $include-last-gutter: true)
|
81
|
+
@if is-column-count($left-gutter)
|
82
|
+
$left-gutter: colspan-to-width($left-gutter, $device, $include-last-gutter: true)
|
67
83
|
|
68
84
|
// Calculate derived metrics
|
69
85
|
$right-border-width: right-value($border-width, $differing-right-border-width)
|
@@ -97,23 +113,23 @@ $grid-width: $grid-column-width * $grid-columns + $grid-gutter-width * $grid-gut
|
|
97
113
|
@else if $gutter
|
98
114
|
margin-right: $gutter
|
99
115
|
|
100
|
-
@function colspan-to-width($colspan, $include-last-gutter: false)
|
101
|
-
@if
|
102
|
-
@return column-count-to-width($colspan, $include-last-gutter)
|
116
|
+
@function colspan-to-width($colspan, $device: default-device(), $include-last-gutter: false)
|
117
|
+
@if is-column-count($colspan)
|
118
|
+
@return column-count-to-width($colspan, $device, $include-last-gutter)
|
103
119
|
@else
|
104
120
|
@return $colspan
|
105
121
|
|
106
|
-
@function
|
122
|
+
@function is-column-count($colspan)
|
107
123
|
@if type_of($colspan) == 'number'
|
108
124
|
@if unitless($colspan) and $colspan > 0
|
109
125
|
@return true
|
110
126
|
@return false
|
111
127
|
|
112
|
-
@function column-count-to-width($column-count, $include-last-gutter: false)
|
128
|
+
@function column-count-to-width($column-count, $device: default-device(), $include-last-gutter: false)
|
113
129
|
@if $include-last-gutter
|
114
|
-
@return (
|
130
|
+
@return (grid-column-width($device) + grid-gutter-width($device)) * $column-count
|
115
131
|
@else
|
116
|
-
@return
|
132
|
+
@return grid-column-width($device) * $column-count + grid-gutter-width($device) * ($column-count - 1)
|
117
133
|
|
118
134
|
// adds to comparable values or doubles the first one
|
119
135
|
@function left-and-right-sum($value, $differing-right-value)
|
@@ -2,17 +2,16 @@
|
|
2
2
|
//==========================
|
3
3
|
// Copy this into your app in order to customize the grid
|
4
4
|
|
5
|
-
//
|
6
|
-
$
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
//
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
// For the default values, that is 30px * 25 + 10px * 24 = 990px
|
5
|
+
// Configure grid for every device you whish to respond to
|
6
|
+
// The nth entry of any list belongs to the nth device (the order of $devices matters).
|
7
|
+
// The lists can take any number of devices, including 1.
|
8
|
+
// If you do not plan to support multiple devices, you may want to delete all but the first entries.
|
9
|
+
// The first device is the default for all grid helpers.
|
10
|
+
// Consider to set mobile as default device when following the mobile-first design approach.
|
11
|
+
$devices: desktop, tablet, handheld-640, handheld-320 !default
|
12
|
+
$grid-column-widths: 30px, 30px, 20px, 20px !default
|
13
|
+
$grid-gutter-widths: 10px, 10px, 5px, 5px !default
|
14
|
+
$grid-columns: 30, 25, 25, 13 !default
|
16
15
|
|
17
16
|
// This import statement has to be included in your application stylesheet
|
18
|
-
@import crispy
|
17
|
+
@import crispy/grid
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: crispy-grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Christian Peters
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-12-
|
13
|
+
date: 2011-12-30 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: compass
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 3.1.
|
34
|
+
version: 3.1.2
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
37
|
description: In short, Crispy Grid closes the gap between easy-to-use grids for simple web pages and doing everything by hand due to layout complexity.
|