forked from greendog99/greendog-rails-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_grid.rb
98 lines (79 loc) · 2.17 KB
/
_grid.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
# Set up custom 960px CSS grid
puts "Creating CSS grid framework ...".magenta
inject_into_file 'app/stylesheets/style.sass', :after => "@import \"partials/example\";\n\n" do
<<-SASS.gsub(/^ {4}/, '')
// Import the custom grid layout
@import partials/grid
SASS
end
file 'app/stylesheets/partials/_grid.sass', <<-SASS.gsub(/^ {2}/, '')
/* From http://www.1kbgrid.com/
$columns: 12
$col_width: 60px
$gutter: 20px
$margin = $gutter / 2
$width = $columns * ($col_width + $gutter)
=row
width: $width
margin: 0 auto
overflow: hidden
=inner_row
margin: 0 ($margin * -1)
width: auto
display: inline-block
=col($n: 1)
margin: 0 $margin
overflow: hidden
float: left
display: inline
width: ($n - 1) * ($col_width + $gutter) + $col_width
=prepend($n: 1)
margin-left: $n * ($col_width + $gutter) + $margin
=append($n: 1)
margin-right: $n * ($col_width + $gutter) + $margin
// Add the .row class to a div to start a new row. Can be nested
.row
+row
.row .row
+inner_row
// Some sample classes to get started with columns. You should create
// your own semantic classes (e.g. section.welcome, div.blog, div.post...)
.non_semantic_12col
+col(12)
.non_semantic_8col
+col(8)
.non_semantic_4col
+col(4)
.non_semantic_4col_tall
+col(4)
p
line-height: 170px
//
// Sample HAML to draw a grid
//
// .row
// .non_semantic_12col
// %p 12
//
// .row
// .non_semantic_8col
// %p 8
// .row
// .non_semantic_4col
// %p 4
// .non_semantic_4col
// %p 4
// .non_semantic_4col_tall
// %p 4
//
// ---------------------------------------------------
// | 12 |
// ---------------------------------------------------
// ---------------------------------- ----------------
// | 8 | | |
// ---------------------------------- | 4 |
// ----------------- ---------------- | |
// | 4 | | 4 | | |
// ----------------- ---------------- ----------------
//
SASS