redgreengrid 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.md +149 -0
- data/Rakefile +16 -0
- data/VERSION +1 -0
- data/init.rb +1 -0
- data/lib/redgreengrid/helpers.rb +22 -0
- data/lib/redgreengrid.rb +14 -0
- data/pkg/redgreengrid-0.1.0.gem +0 -0
- data/redgreengrid.gemspec +61 -0
- data/sass/redgreengrid/_development.sass +50 -0
- data/sass/redgreengrid/_redgreengrid.sass +3 -0
- data/sass/redgreengrid/_reset.sass +37 -0
- data/sass/redgreengrid/_typography.sass +68 -0
- data/sass/redgreengrid/typography/_arial_13_20.sass +23 -0
- data/sass/redgreengrid/typography/_helvetica_13_20.sass +19 -0
- data/sass/redgreengrid/typography/_lucida_13_20.sass +12 -0
- data/sass/redgreengrid/typography/_verdana_12_20.sass +18 -0
- data/spec/redgreengrid/helpers_spec.rb +43 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +14 -0
- data/templates/screen.sass +10 -0
- metadata +76 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Nico Hagenburger - www.hagenburger.net
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
RedGreenGrid
|
2
|
+
============
|
3
|
+
|
4
|
+
***Early alpha version. Internet Explorer not finished yet.***
|
5
|
+
|
6
|
+
A Compass plugin for all those who love typography.
|
7
|
+
RedGreenGrid provides a cross browser baseline grid for Helvetica, Arial, Verdana and Lucida Grande.
|
8
|
+
Other fonts can be easily added.
|
9
|
+
|
10
|
+
There are two grids:
|
11
|
+
|
12
|
+
- **Green**: The baseline grid for all text
|
13
|
+
- **Red**: The grid for all other elements (design, photos, boxes, …)
|
14
|
+
|
15
|
+
Why two grids?
|
16
|
+
The answer is easy: I wouldn’t look good with only one.
|
17
|
+
With a red and a greed grid, it’s very easy to create well-balanced layouts from the scratch.
|
18
|
+
|
19
|
+
|
20
|
+
Example
|
21
|
+
-------
|
22
|
+
|
23
|
+
Add to your screen.sass:
|
24
|
+
|
25
|
+
// import basics
|
26
|
+
@import redgreengrid/redgreengrid.sass
|
27
|
+
// set font family
|
28
|
+
@import redgreengrid/typography/helvetica.sass
|
29
|
+
// add RedGreenGrid
|
30
|
+
+rgg
|
31
|
+
// add styles to show the baseline grid
|
32
|
+
+rgg-development
|
33
|
+
|
34
|
+
Add to your layout/application.html.haml:
|
35
|
+
|
36
|
+
%body{ :class => browser_class }
|
37
|
+
= redgreengrid
|
38
|
+
|
39
|
+
|
40
|
+
Font Sizes
|
41
|
+
----------
|
42
|
+
|
43
|
+
A RedGreenGrid based layout should have three font sizes: normal, big, huge.
|
44
|
+
You can define which CSS selectors will get which size.
|
45
|
+
Here’s the default.
|
46
|
+
Be sure to place your changes on top of the @imports:
|
47
|
+
|
48
|
+
!rgg_normal = "p, li, dt, dd, td, th, h3, h4, h5, h6, address"
|
49
|
+
!rgg_big = "h2, legend"
|
50
|
+
!rgg_huge = "h1"
|
51
|
+
|
52
|
+
@import redgreengrid/redgreengrid.sass
|
53
|
+
@import redgreengrid/typography/helvetica.sass
|
54
|
+
+rgg
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
Implementations Details
|
60
|
+
=======================
|
61
|
+
|
62
|
+
|
63
|
+
Mix-Ins
|
64
|
+
-------
|
65
|
+
|
66
|
+
Maybe you’ll ask, why font size selectors aren’t implemented as mix-in?
|
67
|
+
That’s because it needs a lot of browser fixes which can’t be done easily with mix-ins and would generate a lot of duplicate code.
|
68
|
+
Let’s stay DRY.
|
69
|
+
|
70
|
+
|
71
|
+
Browser Fixes
|
72
|
+
-------------
|
73
|
+
|
74
|
+
To make happy all of you who hate * or _ hacks,
|
75
|
+
to get standards compliant CSS files
|
76
|
+
and to avoid separate IE files (we would need separate Safari, Firefox and Opera files)
|
77
|
+
browser fixes are made with a browser super class:
|
78
|
+
|
79
|
+
.webkit h1
|
80
|
+
:fixes
|
81
|
+
.gecko p, .presto p
|
82
|
+
:fixes
|
83
|
+
.trident h2
|
84
|
+
:fixes
|
85
|
+
|
86
|
+
This browser superclass should be placed in the `<body>` tag.
|
87
|
+
RedGreenGrid provides a helper method `browser_class` for this task.
|
88
|
+
|
89
|
+
The following classes will be created:
|
90
|
+
|
91
|
+
* **.webkit** – Safari, Google Chrome
|
92
|
+
* **.gecko** – Firefox, Mozilla
|
93
|
+
* **.trident** – Windows Internet Explorer
|
94
|
+
* **.presto** – Opera
|
95
|
+
* **.other-browser**
|
96
|
+
|
97
|
+
|
98
|
+
Baseline Adjustments
|
99
|
+
--------------------
|
100
|
+
|
101
|
+
Each font size must be adjusted to the baseline on each browser.
|
102
|
+
I’ve did this by `position: relative`.
|
103
|
+
There are two mix-ins which help you for this job:
|
104
|
+
|
105
|
+
+up(1px)
|
106
|
+
+down(2px)
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
Extend RedGreenGrid
|
112
|
+
===================
|
113
|
+
|
114
|
+
|
115
|
+
Changes to Font Size and Line Height
|
116
|
+
------------------------------------
|
117
|
+
|
118
|
+
The default line height is 20px.
|
119
|
+
If you want to change the font size or line height:
|
120
|
+
|
121
|
+
1. copy the SASS file of your preferred font family
|
122
|
+
2. change the sizes
|
123
|
+
3. name the file `_<font-family>_<font-size>_<line-height>.sass`
|
124
|
+
4. test it and fix it for “all” browsers
|
125
|
+
5. make a pull request for RedGreenGrid to share it
|
126
|
+
|
127
|
+
|
128
|
+
Add New Font Families
|
129
|
+
---------------------
|
130
|
+
|
131
|
+
Do it the same way like new font sizes/line heights.
|
132
|
+
|
133
|
+
|
134
|
+
Bug Fixes
|
135
|
+
---------
|
136
|
+
|
137
|
+
Feel free to make a pull request.
|
138
|
+
|
139
|
+
|
140
|
+
Suggestions, Ideas, Critics
|
141
|
+
---------------------------
|
142
|
+
|
143
|
+
I love to hear from you.
|
144
|
+
Just drop me a mail to nico .. hagenburger .. net.
|
145
|
+
Follow me on [Twitter](http://twitter.com/Hagenburger).
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
Copyright (c) 2009 Nico Hagenburger <http://www.hagenburger.net>, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gemspec|
|
6
|
+
gemspec.name = "redgreengrid"
|
7
|
+
gemspec.summary = "Compass extention for creating baseline grid layouts"
|
8
|
+
gemspec.description = "RedGreenGred makes it easy for you to build cross-browser baseline grid layouts."
|
9
|
+
gemspec.email = "redgreengrid@hagenburger.net"
|
10
|
+
gemspec.homepage = "http://github.com/hagenburger/redgreengrid"
|
11
|
+
gemspec.authors = ["Nico Hagenburger"]
|
12
|
+
end
|
13
|
+
Jeweler::GemcutterTasks.new
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
16
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/lib/redgreengrid"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RedGreenGrid
|
2
|
+
module Helpers
|
3
|
+
|
4
|
+
def redgreengrid(count = 24)
|
5
|
+
div = '<div></div>'
|
6
|
+
"<div id=\"redgreengrid-red\">#{div * count}</div>" +
|
7
|
+
"<div id=\"redgreengrid-green\">#{div * count}</div>"
|
8
|
+
end
|
9
|
+
|
10
|
+
def browser_class
|
11
|
+
case request.user_agent
|
12
|
+
when /(webkit|khtml|presto|trident|gecko)/i
|
13
|
+
$~[1].downcase
|
14
|
+
when /msie/i
|
15
|
+
'trident'
|
16
|
+
else
|
17
|
+
'other-browser'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/lib/redgreengrid.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Redgreengrid
|
2
|
+
|
3
|
+
require 'redgreengrid/helpers'
|
4
|
+
|
5
|
+
ActionView::Base.class_eval do
|
6
|
+
include RedGreenGrid::Helpers
|
7
|
+
end
|
8
|
+
|
9
|
+
options = {
|
10
|
+
:stylesheets_directory => File.expand_path(File.join(File.dirname(__FILE__), '..', 'sass')),
|
11
|
+
:templates_directory => File.expand_path(File.join(File.dirname(__FILE__), '..', 'templates'))
|
12
|
+
}
|
13
|
+
|
14
|
+
Compass::Frameworks.register('redgreengrid', options)
|
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{redgreengrid}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Nico Hagenburger"]
|
12
|
+
s.date = %q{2009-11-21}
|
13
|
+
s.description = %q{RedGreenGred makes it easy for you to build cross-browser baseline grid layouts.}
|
14
|
+
s.email = %q{redgreengrid@hagenburger.net}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.md",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"init.rb",
|
24
|
+
"lib/redgreengrid.rb",
|
25
|
+
"lib/redgreengrid/helpers.rb",
|
26
|
+
"pkg/redgreengrid-0.1.0.gem",
|
27
|
+
"redgreengrid.gemspec",
|
28
|
+
"sass/redgreengrid/_development.sass",
|
29
|
+
"sass/redgreengrid/_redgreengrid.sass",
|
30
|
+
"sass/redgreengrid/_reset.sass",
|
31
|
+
"sass/redgreengrid/_typography.sass",
|
32
|
+
"sass/redgreengrid/typography/_arial_13_20.sass",
|
33
|
+
"sass/redgreengrid/typography/_helvetica_13_20.sass",
|
34
|
+
"sass/redgreengrid/typography/_lucida_13_20.sass",
|
35
|
+
"sass/redgreengrid/typography/_verdana_12_20.sass",
|
36
|
+
"spec/redgreengrid/helpers_spec.rb",
|
37
|
+
"spec/spec.opts",
|
38
|
+
"spec/spec_helper.rb",
|
39
|
+
"templates/screen.sass"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://github.com/hagenburger/redgreengrid}
|
42
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
43
|
+
s.require_paths = ["lib"]
|
44
|
+
s.rubygems_version = %q{1.3.5}
|
45
|
+
s.summary = %q{Compass extention for creating baseline grid layouts}
|
46
|
+
s.test_files = [
|
47
|
+
"spec/redgreengrid/helpers_spec.rb",
|
48
|
+
"spec/spec_helper.rb"
|
49
|
+
]
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
53
|
+
s.specification_version = 3
|
54
|
+
|
55
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
56
|
+
else
|
57
|
+
end
|
58
|
+
else
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
=rgg-development(!show_grid = true)
|
2
|
+
#redgreengrid-columns, #redgreengrid-red, #redgreengrid-green
|
3
|
+
:display none
|
4
|
+
@if !show_grid
|
5
|
+
#redgreengrid-columns, #redgreengrid-red, #redgreengrid-green
|
6
|
+
:display block
|
7
|
+
|
8
|
+
#redgreengrid-columns
|
9
|
+
:bottom 0
|
10
|
+
:display none
|
11
|
+
:padding-left = 1000px
|
12
|
+
:position fixed
|
13
|
+
:top 0
|
14
|
+
:z-index 999
|
15
|
+
|
16
|
+
div
|
17
|
+
:background #F33CE7
|
18
|
+
:float left
|
19
|
+
:height 100%
|
20
|
+
:margin-right = 0
|
21
|
+
:opacity 0.3
|
22
|
+
:width = 0
|
23
|
+
|
24
|
+
|
25
|
+
#redgreengrid-red
|
26
|
+
:bottom 0
|
27
|
+
:position absolute
|
28
|
+
:top 0
|
29
|
+
:z-index 999
|
30
|
+
:width 0
|
31
|
+
|
32
|
+
div
|
33
|
+
:border-bottom 1px #F33CE7 solid
|
34
|
+
:margin-top = !rgg_line_height - 1px
|
35
|
+
:opacity 0.1
|
36
|
+
:width = 1280px
|
37
|
+
|
38
|
+
|
39
|
+
#redgreengrid-green
|
40
|
+
:bottom 0
|
41
|
+
:position absolute
|
42
|
+
:top -6px
|
43
|
+
:z-index 999
|
44
|
+
:width 0
|
45
|
+
|
46
|
+
div
|
47
|
+
:border-bottom 1px #50C45E solid
|
48
|
+
:margin-top = !rgg_line_height - 1px
|
49
|
+
:opacity 0.2
|
50
|
+
:width = 1280px
|
@@ -0,0 +1,37 @@
|
|
1
|
+
a, body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, form, fieldset, legend, p, pre, span, th, td
|
2
|
+
:background-repeat no-repeat
|
3
|
+
:margin 0
|
4
|
+
:padding 0
|
5
|
+
|
6
|
+
table
|
7
|
+
:border-collapse collapse
|
8
|
+
:border-spacing 0
|
9
|
+
|
10
|
+
fieldset, img
|
11
|
+
:border 0
|
12
|
+
|
13
|
+
address, em, th
|
14
|
+
:font-style normal
|
15
|
+
:font-weight normal
|
16
|
+
|
17
|
+
li
|
18
|
+
:list-style none
|
19
|
+
|
20
|
+
th
|
21
|
+
:font-style normal
|
22
|
+
:text-align left
|
23
|
+
|
24
|
+
h1, h2, h3, h4, h5, h6, small
|
25
|
+
:font-size 100%
|
26
|
+
|
27
|
+
input, textarea, select
|
28
|
+
:font-family inherit
|
29
|
+
:font-size inherit
|
30
|
+
:font-weight inherit
|
31
|
+
|
32
|
+
.msie
|
33
|
+
input, textarea, select
|
34
|
+
:font-size 100%
|
35
|
+
|
36
|
+
header, section, article, aside, footer, time
|
37
|
+
:display block
|
@@ -0,0 +1,68 @@
|
|
1
|
+
!rgg_small ||= "small"
|
2
|
+
!rgg_normal ||= "p, li, dt, dd, td, th, h3, h4, h5, h6, address"
|
3
|
+
!rgg_big ||= "h2, legend"
|
4
|
+
!rgg_huge ||= "h1"
|
5
|
+
!rgg_bold ||= "h1, h2, h3, h4, h5, h6, strong, th"
|
6
|
+
!rgg_inline_text ||= ""
|
7
|
+
!rgg_inline_container ||= ""
|
8
|
+
|
9
|
+
|
10
|
+
=up(!pixels)
|
11
|
+
:position relative
|
12
|
+
:bottom = !pixels
|
13
|
+
|
14
|
+
|
15
|
+
=down(!pixels)
|
16
|
+
+up(-!pixels)
|
17
|
+
|
18
|
+
|
19
|
+
=typography(!tag, !tag_font_size, !tag_line_height, !tag_position = false)
|
20
|
+
#{!tag}
|
21
|
+
:font-size = !tag_font_size
|
22
|
+
:line-height = !tag_line_height
|
23
|
+
:margin = 0 0 !rgg_line_height
|
24
|
+
@if !tag_position
|
25
|
+
:position relative
|
26
|
+
:bottom = !tag_position
|
27
|
+
|
28
|
+
|
29
|
+
=float-left(!lines)
|
30
|
+
:height = !lines * !rgg_line_height
|
31
|
+
:float left
|
32
|
+
:margin = 0 !rgg_line_height !rgg_line_height 0
|
33
|
+
|
34
|
+
|
35
|
+
=float-right(!lines)
|
36
|
+
:height = !lines * !rgg_line_height
|
37
|
+
:float right
|
38
|
+
:margin = 0 0 !rgg_line_height !rgg_line_height
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
=rgg
|
43
|
+
.box
|
44
|
+
+float-left(2)
|
45
|
+
:width 40px
|
46
|
+
:background #ccc
|
47
|
+
|
48
|
+
ul.list li
|
49
|
+
:list-style circle
|
50
|
+
:margin-left = !rgg_line_height
|
51
|
+
|
52
|
+
ol.list li
|
53
|
+
:list-style decimal
|
54
|
+
:margin-left = !rgg_line_height
|
55
|
+
|
56
|
+
hr
|
57
|
+
:border none
|
58
|
+
:border-bottom 1px #ccc dotted
|
59
|
+
:margin = !rgg_line_height 1px !rgg_line_height - 1px 0
|
60
|
+
+up(1px)
|
61
|
+
|
62
|
+
.gecko hr
|
63
|
+
:margin-bottom = !rgg_line_height - 2px
|
64
|
+
+up(2px)
|
65
|
+
|
66
|
+
@if !rgg_inline_container != ""
|
67
|
+
#{!rgg_inline_container}
|
68
|
+
:bottom 0
|
@@ -0,0 +1,23 @@
|
|
1
|
+
!rgg_font_size ||= 13px
|
2
|
+
!rgg_line_height ||= 20px
|
3
|
+
|
4
|
+
body
|
5
|
+
:font-family "Arial", "Helvetica", "sans-serif"
|
6
|
+
|
7
|
+
#{!rgg_bold}
|
8
|
+
:font-weight bold
|
9
|
+
|
10
|
+
+typography(!rgg_huge, 37px, !rgg_line_height * 2, -1px)
|
11
|
+
+typography(!rgg_big, 16px, !rgg_line_height, 1px)
|
12
|
+
+typography(!rgg_normal, !rgg_font_size, !rgg_line_height, )
|
13
|
+
|
14
|
+
.presto
|
15
|
+
#{!rgg_huge}
|
16
|
+
+down(2px)
|
17
|
+
|
18
|
+
.gecko
|
19
|
+
#{!rgg_big}
|
20
|
+
+up(2px)
|
21
|
+
|
22
|
+
#{!rgg_normal}
|
23
|
+
+up(1px)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
!rgg_font_size ||= 13px
|
2
|
+
!rgg_line_height ||= 20px
|
3
|
+
|
4
|
+
body
|
5
|
+
:font-family "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", "Swiss 721 Light", "Helvetica", "Arial", "sans-serif"
|
6
|
+
:font-weight 200
|
7
|
+
|
8
|
+
#{!rgg_bold}
|
9
|
+
:font-family "HelveticaNeue-Bold", "Helvetica Neue Bold", "Helvetica Neue", "Swiss 721 Bold", "Helvetica", "Arial", "sans-serif"
|
10
|
+
:font-weight bold
|
11
|
+
|
12
|
+
+typography(!rgg_huge, 37px, !rgg_line_height * 2 )
|
13
|
+
+typography(!rgg_big, 16px, !rgg_line_height, 2px)
|
14
|
+
+typography(!rgg_normal, !rgg_font_size, !rgg_line_height, 1px)
|
15
|
+
|
16
|
+
.presto
|
17
|
+
#{!rgg_big}
|
18
|
+
+up(2px)
|
19
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
!rgg_font_size ||= 13px
|
2
|
+
!rgg_line_height ||= 20px
|
3
|
+
|
4
|
+
body
|
5
|
+
:font-family "Lucida Grande", "Tahoma", "Vera Sans", "Helvetica", "Arial", "sans-serif"
|
6
|
+
|
7
|
+
#{!rgg_bold}
|
8
|
+
:font-weight bold
|
9
|
+
|
10
|
+
+typography(!rgg_huge, 36px, !rgg_line_height * 2 )
|
11
|
+
+typography(!rgg_big, 16px, !rgg_line_height, 2px)
|
12
|
+
+typography(!rgg_normal, !rgg_font_size, !rgg_line_height, 1px)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
!rgg_font_size ||= 12px
|
2
|
+
!rgg_line_height ||= 20px
|
3
|
+
|
4
|
+
body
|
5
|
+
:font-family "Verdana", "Tahoma", "Vera Sans", "Helvetica", "Arial", "sans-serif"
|
6
|
+
|
7
|
+
#{!rgg_bold}
|
8
|
+
:font-weight bold
|
9
|
+
|
10
|
+
+typography(!rgg_huge, 35px, !rgg_line_height * 2 )
|
11
|
+
+typography(!rgg_big, 16px, !rgg_line_height, 2px)
|
12
|
+
+typography(!rgg_normal, !rgg_font_size, !rgg_line_height )
|
13
|
+
|
14
|
+
.gecko
|
15
|
+
#{!rgg_big}
|
16
|
+
+up(3px)
|
17
|
+
#{!rgg_normal}
|
18
|
+
+up(1px)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe RedGreenGrid::Helpers do
|
4
|
+
include RedGreenGrid::Helpers
|
5
|
+
|
6
|
+
it "should render the grid" do
|
7
|
+
result = redgreengrid
|
8
|
+
|
9
|
+
result.should have_tag("#redgreengrid-red div", 24)
|
10
|
+
result.should have_tag("#redgreengrid-green div", 24)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should render the grid with own count" do
|
14
|
+
result = redgreengrid(50)
|
15
|
+
|
16
|
+
result.should have_tag("#redgreengrid-red div", 50)
|
17
|
+
result.should have_tag("#redgreengrid-green div", 50)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should generate the right browser class" do
|
21
|
+
[
|
22
|
+
['Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6c', 'other-browser'],
|
23
|
+
['Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)', 'trident'],
|
24
|
+
['Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618)', 'trident'],
|
25
|
+
['Mozilla/4.77 [en] (X11; I; IRIX;64 6.5 IP30)', 'other-browser'],
|
26
|
+
['Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.6.2) (KHTML, like Gecko)', ''],
|
27
|
+
['Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8', 'webkit'],
|
28
|
+
['Mozilla/5.0 (OS/2; U; Warp 4.5; de; rv:1.8.1.11) Gecko/20071129 PmWFx/2.0.0.11', 'gecko'],
|
29
|
+
['Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13', 'webkit'],
|
30
|
+
['Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10', 'gecko'],
|
31
|
+
['Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3) Gecko/20040924 Epiphany/1.4.4 (Ubuntu)', 'gecko'],
|
32
|
+
['Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00', 'presto']
|
33
|
+
].each do |user_agent, rendering_engine|
|
34
|
+
@user_agent = user_agent
|
35
|
+
browser_class.should =~ /#{rendering_engine}/
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def request
|
40
|
+
mock('request', :user_agent => @user_agent)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= 'test'
|
2
|
+
require File.dirname(__FILE__) + "/../../../../config/environment" unless defined?(RAILS_ROOT)
|
3
|
+
require 'spec/autorun'
|
4
|
+
require 'spec/rails'
|
5
|
+
require 'action_controller'
|
6
|
+
require 'action_controller/assertions/selector_assertions'
|
7
|
+
|
8
|
+
include ActionController::Assertions::SelectorAssertions
|
9
|
+
|
10
|
+
require File.dirname(__FILE__) + "/../lib/redgreengrid"
|
11
|
+
|
12
|
+
Spec::Runner.configure do |config|
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
@import redgreengrid/redgreengrid.sass
|
2
|
+
|
3
|
+
// Choose your favorite font family, size and line height:
|
4
|
+
@import redgreengrid/typography/helvetica_13_20.sass
|
5
|
+
//@import redgreengrid/typography/lucida_13_20.sass
|
6
|
+
//@import redgreengrid/typography/verdana_12_20.sass
|
7
|
+
//@import redgreengrid/typography/arial_13_20.sass
|
8
|
+
|
9
|
+
+rgg
|
10
|
+
+rgg-development
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redgreengrid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nico Hagenburger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-21 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: RedGreenGred makes it easy for you to build cross-browser baseline grid layouts.
|
17
|
+
email: redgreengrid@hagenburger.net
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.md
|
24
|
+
files:
|
25
|
+
- MIT-LICENSE
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- VERSION
|
29
|
+
- init.rb
|
30
|
+
- lib/redgreengrid.rb
|
31
|
+
- lib/redgreengrid/helpers.rb
|
32
|
+
- pkg/redgreengrid-0.1.0.gem
|
33
|
+
- redgreengrid.gemspec
|
34
|
+
- sass/redgreengrid/_development.sass
|
35
|
+
- sass/redgreengrid/_redgreengrid.sass
|
36
|
+
- sass/redgreengrid/_reset.sass
|
37
|
+
- sass/redgreengrid/_typography.sass
|
38
|
+
- sass/redgreengrid/typography/_arial_13_20.sass
|
39
|
+
- sass/redgreengrid/typography/_helvetica_13_20.sass
|
40
|
+
- sass/redgreengrid/typography/_lucida_13_20.sass
|
41
|
+
- sass/redgreengrid/typography/_verdana_12_20.sass
|
42
|
+
- spec/redgreengrid/helpers_spec.rb
|
43
|
+
- spec/spec.opts
|
44
|
+
- spec/spec_helper.rb
|
45
|
+
- templates/screen.sass
|
46
|
+
has_rdoc: true
|
47
|
+
homepage: http://github.com/hagenburger/redgreengrid
|
48
|
+
licenses: []
|
49
|
+
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options:
|
52
|
+
- --charset=UTF-8
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 1.3.5
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: Compass extention for creating baseline grid layouts
|
74
|
+
test_files:
|
75
|
+
- spec/redgreengrid/helpers_spec.rb
|
76
|
+
- spec/spec_helper.rb
|