modular-grid 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/Gruntfile.coffee +81 -0
- data/LICENSE +20 -0
- data/README.md +34 -0
- data/Rakefile +4 -0
- data/app/assets/stylesheets/_modular.scss +2 -0
- data/app/assets/stylesheets/dist.scss +4 -0
- data/app/assets/stylesheets/grid/_container.scss +23 -0
- data/app/assets/stylesheets/grid/_debug.scss +40 -0
- data/app/assets/stylesheets/grid/_defaults.scss +25 -0
- data/app/assets/stylesheets/grid/_margin.scss +7 -0
- data/app/assets/stylesheets/grid/_module.scss +16 -0
- data/app/assets/stylesheets/grid/_render.scss +122 -0
- data/app/assets/stylesheets/grid/utils/_media.scss +12 -0
- data/app/assets/stylesheets/grid/utils/_reset.scss +12 -0
- data/css/modular.css +321 -0
- data/css/modular.css.map +7 -0
- data/css/modular.min.css +2 -0
- data/example/example.css +352 -0
- data/example/example.css.map +7 -0
- data/example/example.scss +42 -0
- data/example/favicon.ico +0 -0
- data/example/index.html +34 -0
- data/lib/modular.rb +5 -0
- data/lib/modular/version.rb +3 -0
- data/modular.gemspec +24 -0
- data/package.json +32 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 22c72528a86637044492bde9d9f029e61ff04220
|
4
|
+
data.tar.gz: a561bbde2c54e6a16e503c694770369595616d07
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad5ff7ee652b9100afa8cb28770558bcdbff212d994b58c417fe8795e6120ef34ed5008ce5baeeb11847cdc87512470706da2e04e01ed093d41b2916aa917e0a
|
7
|
+
data.tar.gz: 4933779410122a60b8c165881e7e27a48a1fbc24be800bc2e70f817bd0ce3425a84a9e042502802a970318d8925f0a6fb1cff0dee0468275a262c74b941180ed
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gruntfile.coffee
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
|
2
|
+
module.exports = (grunt)->
|
3
|
+
version = ->
|
4
|
+
grunt.file.readJSON("package.json").version
|
5
|
+
version_text = ->
|
6
|
+
"v#{version()}"
|
7
|
+
|
8
|
+
repo = "https://github.com/dylan/modular"
|
9
|
+
|
10
|
+
grunt.initConfig
|
11
|
+
pkg: grunt.file.readJSON("package.json")
|
12
|
+
repo: repo
|
13
|
+
|
14
|
+
comments: """
|
15
|
+
/*
|
16
|
+
// <%= pkg.name %>
|
17
|
+
// v<%= pkg.version %>
|
18
|
+
// Built on <%= grunt.template.today("yyyy-mm-dd") %>
|
19
|
+
// Full source at <%= repo %>
|
20
|
+
//
|
21
|
+
// MIT License, <%= repo %>/blob/master/LICENSE
|
22
|
+
// This file is generated by `grunt build` do not edit it by hand.
|
23
|
+
*/\n
|
24
|
+
"""
|
25
|
+
minified_comments: "/* <%= pkg.name %> v<%= pkg.version %>, MIT License <%= repo %>/blob/master/LICENSE */"
|
26
|
+
|
27
|
+
sass:
|
28
|
+
dist:
|
29
|
+
files:
|
30
|
+
'css/modular.css':'app/assets/stylesheets/dist.scss'
|
31
|
+
'example/example.css':'example/example.scss'
|
32
|
+
|
33
|
+
express:
|
34
|
+
all:
|
35
|
+
options:
|
36
|
+
hostname: '*'
|
37
|
+
port: 3000
|
38
|
+
bases: 'example'
|
39
|
+
|
40
|
+
open:
|
41
|
+
all:
|
42
|
+
path: 'http://localhost:<%= express.all.options.port %>'
|
43
|
+
|
44
|
+
cssmin:
|
45
|
+
minify:
|
46
|
+
expand: true
|
47
|
+
options:
|
48
|
+
banner: '<%= minified_comments %>'
|
49
|
+
cwd: 'css/'
|
50
|
+
src: ['*.css','!*.min.css']
|
51
|
+
dest: 'css/'
|
52
|
+
ext: '.min.css'
|
53
|
+
|
54
|
+
watch:
|
55
|
+
scripts:
|
56
|
+
files: ['app/assets/stylesheets/*.scss','app/assets/stylesheets/*/*.scss','example/*.scss','example/*.html']
|
57
|
+
tasks: ['build']
|
58
|
+
options:
|
59
|
+
livereload: true
|
60
|
+
|
61
|
+
clean:
|
62
|
+
dist: ['.sass-cache','css/*']
|
63
|
+
|
64
|
+
concat:
|
65
|
+
options:
|
66
|
+
banner: '<%= comments %>'
|
67
|
+
css:
|
68
|
+
src: ['css/modular.css']
|
69
|
+
dest: 'css/modular.css'
|
70
|
+
|
71
|
+
|
72
|
+
grunt.loadNpmTasks 'grunt-express'
|
73
|
+
grunt.loadNpmTasks 'grunt-open'
|
74
|
+
grunt.loadNpmTasks 'grunt-notify'
|
75
|
+
grunt.loadNpmTasks 'grunt-contrib-sass'
|
76
|
+
grunt.loadNpmTasks 'grunt-contrib-cssmin'
|
77
|
+
grunt.loadNpmTasks 'grunt-contrib-concat'
|
78
|
+
|
79
|
+
grunt.registerTask 'default', ['build']
|
80
|
+
grunt.registerTask 'build', ['sass','cssmin','concat']
|
81
|
+
grunt.registerTask 'server', ['build','express','open','watch']
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Dylan Wreggelsworth
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Modular Grid System
|
2
|
+
======
|
3
|
+
|
4
|
+
|
5
|
+
### Usage
|
6
|
+
* Drop ```_modular.scss``` and the ```grid``` folder into your assets folder. Then overwrite any options and ```@import 'modular';```.
|
7
|
+
* Initially the grid system has six columns, you can change this in ```grid/_defaults.scss```
|
8
|
+
* An element's width can be defined with the classes ```.m1``` through ```.m6``` (m6 being 100% width).
|
9
|
+
* To define an element's width at several resolutions you extend or use like so: ```.m6-3-1```. The first number is the mobile width, the second is the tablet size, the last is the desktop size. So our module with ```.m6-3-1``` will be full screen width for mobile, half screen width for tablets, and take up 1/6th width for desktop users.
|
10
|
+
* You can also use a value of 0 to hide an element at that particular resolution.
|
11
|
+
* In order to create a complete row you need to extend or use classes so that the total size at each resolution equals the column count. (in this case 6)
|
12
|
+
* You can push things from the left by using the ```.l#``` or ```.l#-#-#``` classes. You can also keep rows clear by using ```.r#``` or ```.r#-#-#```to add right margin.
|
13
|
+
* If you want to corral the little modules and put them in a nice bucket ```@extend %container``` will give the element a nice width with good margins for the three sizes.
|
14
|
+
|
15
|
+
**Example:**
|
16
|
+
These two divs will constitute a row at all three resolutions.
|
17
|
+
|
18
|
+
```
|
19
|
+
<div class="m2-4-4">
|
20
|
+
I'm 2 columns wide at mobile size, and 4 columns wide at other resolutions.
|
21
|
+
</div>
|
22
|
+
<div class="m4-2-2">
|
23
|
+
I'm 4 columns wide at mobile size, and 2 columns wide at other resolutions.
|
24
|
+
</div>
|
25
|
+
```
|
26
|
+
|
27
|
+
### TODO
|
28
|
+
* Create a gem for easy install.
|
29
|
+
* Add the ability to leave off numbers and have it just assume the remaining widths are the last value
|
30
|
+
* Work on the unrolling the loops or something to make the code more legible/faster.
|
31
|
+
* Create Stylus and Less versions.
|
32
|
+
|
33
|
+
### Attribution
|
34
|
+
This was kindly open-sourced by [Groopt Inc.](http://groopt.com) in October of 2013.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
@import 'utils/media';
|
2
|
+
|
3
|
+
.container {
|
4
|
+
margin-left: auto;
|
5
|
+
margin-right: auto;
|
6
|
+
*zoom: 1;
|
7
|
+
@include media(iphone) {
|
8
|
+
width: 100%;
|
9
|
+
}
|
10
|
+
@include media(ipad) {
|
11
|
+
width: 768px;
|
12
|
+
}
|
13
|
+
@include media {
|
14
|
+
width: 1020px;
|
15
|
+
}
|
16
|
+
&:before, &:after {
|
17
|
+
content: " ";
|
18
|
+
display: table;
|
19
|
+
}
|
20
|
+
&:after {
|
21
|
+
clear: both;
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
@if $modular-debug == true {
|
2
|
+
.debug {
|
3
|
+
text-align: center;
|
4
|
+
line-height: 2.5em;
|
5
|
+
font-weight: 300;
|
6
|
+
color: #fff;
|
7
|
+
* {
|
8
|
+
$border-color:rgba(255,255,255,0.25);
|
9
|
+
box-shadow: inset 0 -2px 0 $border-color, inset 2px 0 0 $border-color;
|
10
|
+
@include media(iphone) {
|
11
|
+
background-color: #2A3A48;
|
12
|
+
color: #FAFAFF;
|
13
|
+
}
|
14
|
+
@include media(ipad) {
|
15
|
+
background-color: #3E6372;
|
16
|
+
color: #FAFAFF;
|
17
|
+
}
|
18
|
+
@include media(desktop) {
|
19
|
+
background-color: #B2D4DC;
|
20
|
+
color: #2A3A48;
|
21
|
+
}
|
22
|
+
-webkit-transition: background-color 1s ease-in-out;
|
23
|
+
-moz-transition: background-color 1s ease-in-out;
|
24
|
+
transition: background-color 1s ease-in-out;
|
25
|
+
height: 60px;
|
26
|
+
position: relative;
|
27
|
+
display:block;
|
28
|
+
&:before {
|
29
|
+
content: "class=\""attr(class)"\"";
|
30
|
+
position: absolute;
|
31
|
+
font-size: 13px;
|
32
|
+
line-height:1em;
|
33
|
+
bottom: 2px;
|
34
|
+
right: 0;
|
35
|
+
padding: 4px 8px;
|
36
|
+
background-color: rgba(255,255,255,0.25);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
//What we prefix all our modules classes with.
|
2
|
+
$modular-prefix: m !default;
|
3
|
+
|
4
|
+
//What we call our classes that push things to the left.
|
5
|
+
$modular-left-prefix: l !default;
|
6
|
+
|
7
|
+
//What we call our classes that push things to the right.
|
8
|
+
$modular-right-prefix: r !default;
|
9
|
+
|
10
|
+
//Don't jack this up too high, you'll have exponentially longer render times.
|
11
|
+
$modular-max-cols: 6 !default;
|
12
|
+
|
13
|
+
//Render classes instead of extend-only selectors?
|
14
|
+
$modular-render: false !default;
|
15
|
+
|
16
|
+
//Render debug classes?
|
17
|
+
$modular-debug: false !default;
|
18
|
+
|
19
|
+
// Leave gutters between modules.
|
20
|
+
$show-gutters: false !default;
|
21
|
+
|
22
|
+
//Divide up our row into columns.
|
23
|
+
$colWidth: 100/$modular-max-cols * 1%;
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//
|
2
|
+
// Thehe properties that makes an element a module.
|
3
|
+
//
|
4
|
+
@mixin module-properties {
|
5
|
+
float: left;
|
6
|
+
padding: 0 8px;
|
7
|
+
min-height: 1px;
|
8
|
+
}
|
9
|
+
|
10
|
+
@mixin module-width($amt:1) {
|
11
|
+
width: $colWidth * $amt;
|
12
|
+
}
|
13
|
+
|
14
|
+
@mixin visible-gutters {
|
15
|
+
background-clip: padding-box;
|
16
|
+
}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
@import 'defaults',
|
2
|
+
'container',
|
3
|
+
'module',
|
4
|
+
'margin',
|
5
|
+
'utils/media',
|
6
|
+
'debug';
|
7
|
+
|
8
|
+
$modules: ();
|
9
|
+
|
10
|
+
$dec-type: unquote("%");
|
11
|
+
@if $modular-render == true {
|
12
|
+
$dec-type: unquote(".");
|
13
|
+
}
|
14
|
+
|
15
|
+
@for $i from 1 through $modular-max-cols {
|
16
|
+
//Generate a pool of classes for later use.
|
17
|
+
$modules: append($modules,unquote("#{$dec-type}#{$modular-prefix}#{$i}"),comma) !global;
|
18
|
+
#{$dec-type}#{$modular-prefix}#{$i} { @include module-width($i); }
|
19
|
+
}
|
20
|
+
|
21
|
+
@for $i from 1 through $modular-max-cols {
|
22
|
+
#{$dec-type}#{$modular-left-prefix}#{$i} { @include left-properties($i); }
|
23
|
+
}
|
24
|
+
|
25
|
+
@for $i from 1 through $modular-max-cols {
|
26
|
+
#{$dec-type}#{$modular-right-prefix}#{$i} { @include right-properties($i); }
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
//
|
32
|
+
//TODO Figgr' out how to optimize these loops.
|
33
|
+
//
|
34
|
+
|
35
|
+
@include media(iphone) {
|
36
|
+
$iphone-subClasses: ();
|
37
|
+
$left-iphone-subClasses: ();
|
38
|
+
$right-iphone-subClasses: ();
|
39
|
+
@for $i from 0 through $modular-max-cols {
|
40
|
+
$iphone-subClasses: null;
|
41
|
+
$left-iphone-subClasses: null;
|
42
|
+
$right-iphone-subClasses: null;
|
43
|
+
@for $j from 0 through $modular-max-cols {
|
44
|
+
@for $k from 0 through $modular-max-cols {
|
45
|
+
@if $i == $j and $j == $k {
|
46
|
+
} @else {
|
47
|
+
$iphone-subClasses: append($iphone-subClasses, unquote("#{$dec-type}#{$modular-prefix}#{$i}-#{$j}-#{$k}"), comma);
|
48
|
+
$left-iphone-subClasses: append($left-iphone-subClasses, unquote("#{$dec-type}#{$modular-left-prefix}#{$i}-#{$j}-#{$k}"), comma);
|
49
|
+
$right-iphone-subClasses: append($right-iphone-subClasses, unquote("#{$dec-type}#{$modular-right-prefix}#{$i}-#{$j}-#{$k}"), comma);
|
50
|
+
//Add the variable sized modules to the pool.
|
51
|
+
$modules: append($modules, unquote("#{$dec-type}#{$modular-prefix}#{$i}-#{$j}-#{$k}"),comma) !global;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
@if $i == 0 {
|
56
|
+
#{$iphone-subClasses} { display: none }
|
57
|
+
} @else {
|
58
|
+
#{$iphone-subClasses} { @include module-width($i); }
|
59
|
+
}
|
60
|
+
#{$left-iphone-subClasses} { @include left-properties($i); }
|
61
|
+
#{$right-iphone-subClasses} { @include right-properties($i); }
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
@include media(ipad) {
|
66
|
+
$ipad-subClasses: ();
|
67
|
+
$left-ipad-subClasses: ();
|
68
|
+
$right-ipad-subClasses: ();
|
69
|
+
@for $i from 0 through $modular-max-cols {
|
70
|
+
$ipad-subClasses: null;
|
71
|
+
$left-ipad-subClasses: null;
|
72
|
+
$right-ipad-subClasses: null;
|
73
|
+
@for $j from 0 through $modular-max-cols {
|
74
|
+
@for $k from 0 through $modular-max-cols {
|
75
|
+
@if $i == $j and $j == $k {
|
76
|
+
} @else {
|
77
|
+
$ipad-subClasses: append($ipad-subClasses, unquote("#{$dec-type}#{$modular-prefix}#{$k}-#{$i}-#{$j}"), comma);
|
78
|
+
$left-ipad-subClasses: append($left-ipad-subClasses, unquote("#{$dec-type}#{$modular-left-prefix}#{$k}-#{$i}-#{$j}"), comma);
|
79
|
+
$right-ipad-subClasses: append($right-ipad-subClasses, unquote("#{$dec-type}#{$modular-right-prefix}#{$k}-#{$i}-#{$j}"), comma);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
@if $i == 0 {
|
84
|
+
#{$ipad-subClasses} { display: none }
|
85
|
+
} @else {
|
86
|
+
#{$ipad-subClasses} { @include module-width($i); }
|
87
|
+
}
|
88
|
+
#{$left-ipad-subClasses} { @include left-properties($i); }
|
89
|
+
#{$right-ipad-subClasses} { @include right-properties($i); }
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
@include media {
|
94
|
+
$desktop-subClasses: ();
|
95
|
+
$left-desktop-subClasses: ();
|
96
|
+
$right-desktop-subClasses: ();
|
97
|
+
@for $i from 0 through $modular-max-cols {
|
98
|
+
$desktop-subClasses: null;
|
99
|
+
$left-desktop-subClasses: null;
|
100
|
+
$right-desktop-subClasses: null;
|
101
|
+
@for $j from 0 through $modular-max-cols {
|
102
|
+
@for $k from 0 through $modular-max-cols {
|
103
|
+
@if $i == $j and $j == $k {
|
104
|
+
} @else {
|
105
|
+
$desktop-subClasses: append($desktop-subClasses, unquote("#{$dec-type}#{$modular-prefix}#{$j}-#{$k}-#{$i}"), comma);
|
106
|
+
$left-desktop-subClasses: append($left-desktop-subClasses, unquote("#{$dec-type}#{$modular-left-prefix}#{$j}-#{$k}-#{$i}"), comma);
|
107
|
+
$right-desktop-subClasses: append($right-desktop-subClasses, unquote("#{$dec-type}#{$modular-right-prefix}#{$j}-#{$k}-#{$i}"), comma);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
@if $i == 0 {
|
112
|
+
#{$desktop-subClasses} { display: none }
|
113
|
+
} @else {
|
114
|
+
#{$desktop-subClasses} { @include module-width($i); }
|
115
|
+
}
|
116
|
+
#{$left-desktop-subClasses} { @include left-properties($i); }
|
117
|
+
#{$right-desktop-subClasses} { @include right-properties($i); }
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
// Make all the modules act like modules...
|
122
|
+
#{$modules} { @include module-properties; }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
//
|
2
|
+
// This will surround it's contents with an
|
3
|
+
// appropriate media query.
|
4
|
+
//
|
5
|
+
// @type {iphone,ipad,desktop}
|
6
|
+
//
|
7
|
+
@mixin media($type:desktop){
|
8
|
+
@if $type == iphone { @media (max-width: 767px) { @content } }
|
9
|
+
@else if $type == ipad { @media (min-width: 768px) and (max-width: 1019px) { @content } }
|
10
|
+
@else if $type == desktop { @media (min-width: 1020px) { @content } }
|
11
|
+
@else if $type == retina { @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { @content } }
|
12
|
+
}
|