smashing-layout 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +56 -30
- data/lib/smashing-layout.rb +1 -1
- data/stylesheets/_smashing-layout.sass +8 -6
- metadata +4 -4
data/README.mdown
CHANGED
@@ -1,64 +1,90 @@
|
|
1
1
|
# Smashing Layout
|
2
2
|
|
3
|
-
|
3
|
+
A Sass project that began as an experiment to recreate Smashing Magazine's layout (circa 2009).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
`gem install smashing-layout`
|
7
|
+
`(sudo) gem install smashing-layout`
|
8
8
|
|
9
9
|
Add `require 'smashing-layout'` to your Compass config file.
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
-
There are two mixins that produce all the magic in Smashing Layout.
|
13
|
+
There are two mixins that produce all the magic in Smashing Layout. The `smashing-layout` mixin and the `smashing-width` mixin. I'll cover those in more detail below. But in the meantime, here are the details for the default variables and how to override them.
|
14
14
|
|
15
|
-
###
|
15
|
+
### Default variables
|
16
16
|
|
17
17
|
The `smashing-layout` mixin sets up the core layout based on the default variable configuration or your overrides.
|
18
18
|
|
19
|
-
|
19
|
+
The default configuration of Smashing Layout is listed below. If you plan to override any of these values, do so prior to importing smashing-layout.
|
20
20
|
|
21
21
|
// Configuration
|
22
22
|
$smashing-direction: right
|
23
23
|
$smashing-max-width: 1200px
|
24
|
-
$smashing-min-width:
|
25
|
-
$smashing-
|
24
|
+
$smashing-min-width: 960px
|
25
|
+
$smashing-cushion: 2.5%
|
26
|
+
$smashing-devine: false
|
27
|
+
|
28
|
+
Import Smashing Layout from the extension, like so:
|
29
|
+
|
30
|
+
@import smashing-layout
|
31
|
+
|
32
|
+
### Overriding the default variables
|
33
|
+
|
34
|
+
A proper example of overriding the default variables would look something like this.
|
35
|
+
|
36
|
+
The code below assumes you are keeping the default max and min width, but you'd like to set the sidebar to display on the left vs the default setting of displaying on the right. It also assumes you'd like a bit more cushion on the outside of the layout by setting the `$smashing-cushion`, and sets the left and right padding on the `.width` selector to 5% each vs the default of 2.5%.
|
37
|
+
|
38
|
+
// Configuration
|
39
|
+
$smashing-direction: left
|
40
|
+
$smashing-cushion: 5%
|
41
|
+
@import smashing-layout
|
42
|
+
|
43
|
+
|
44
|
+
### Assumed markup and selectors
|
26
45
|
|
27
|
-
The following markup structure is
|
46
|
+
The following markup and selector structure is assumed to create the two-column Smashing Layout.
|
28
47
|
|
29
|
-
|
30
|
-
.
|
48
|
+
.your-class
|
49
|
+
.width
|
31
50
|
.padding
|
32
|
-
.primary
|
51
|
+
.primary
|
33
52
|
...
|
34
|
-
.secondary
|
53
|
+
.secondary
|
35
54
|
...
|
36
55
|
|
37
|
-
|
56
|
+
I realize this means you are using more presentational selector names in your markup, but that doesn't mean you can't combine those class names with HTML5 elements.
|
38
57
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
58
|
+
## Smashing Mixins
|
59
|
+
|
60
|
+
There are two mixins to use when using Smashing Layout.
|
61
|
+
|
62
|
+
* `smashing-layout`, which takes care of creating the layout
|
63
|
+
* `smashing-width`, which sets up just the width for keeping sections of the design outside the layout the same flexible width
|
64
|
+
|
65
|
+
### `smashing-layout`
|
66
|
+
|
67
|
+
Assumes the following markup and selector structure to work.
|
68
|
+
|
69
|
+
.your-class
|
70
|
+
.width
|
71
|
+
.padding
|
72
|
+
.primary
|
73
|
+
...
|
74
|
+
.secondary
|
75
|
+
...
|
49
76
|
|
50
|
-
|
77
|
+
### `smashing-width`
|
51
78
|
|
52
|
-
|
79
|
+
Assumes the following markup and selector structure to work.
|
53
80
|
|
54
|
-
|
55
|
-
.
|
56
|
-
|
57
|
-
...
|
81
|
+
.your-class
|
82
|
+
.width
|
83
|
+
...
|
58
84
|
|
59
85
|
## License
|
60
86
|
|
61
|
-
Copyright (c) 2009 Adam Stacoviak
|
87
|
+
Copyright (c) 2009-2011 Adam Stacoviak
|
62
88
|
|
63
89
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
64
90
|
|
data/lib/smashing-layout.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
// Configuration
|
4
4
|
$smashing-direction: right !default
|
5
|
-
$smashing-max-width:
|
5
|
+
$smashing-max-width: 1200px !default
|
6
6
|
$smashing-min-width: 960px !default
|
7
|
-
$smashing-cushion:
|
7
|
+
$smashing-cushion: 2.5% !default
|
8
8
|
$smashing-devine: false !default
|
9
9
|
|
10
10
|
// Layout variables
|
@@ -17,7 +17,7 @@ $smashing-negative-sidebar-width-divine: -(ceil($smashing-sidebar-width-divine))
|
|
17
17
|
=smashing-layout
|
18
18
|
+smashing-width
|
19
19
|
+smashing-padding
|
20
|
-
+smashing-
|
20
|
+
+smashing-content
|
21
21
|
|
22
22
|
// Sets a div's width to behave like the width of +smashing-layout
|
23
23
|
// Assumes an inner wrapping div .width
|
@@ -29,7 +29,9 @@ $smashing-negative-sidebar-width-divine: -(ceil($smashing-sidebar-width-divine))
|
|
29
29
|
margin: 0 auto
|
30
30
|
min-width: $smashing-min-width
|
31
31
|
max-width: $smashing-max-width
|
32
|
-
padding:
|
32
|
+
padding:
|
33
|
+
right: $smashing-cushion
|
34
|
+
left: $smashing-cushion
|
33
35
|
|
34
36
|
// Used only in +smashing-layout
|
35
37
|
=smashing-padding
|
@@ -43,8 +45,8 @@ $smashing-negative-sidebar-width-divine: -(ceil($smashing-sidebar-width-divine))
|
|
43
45
|
width: 100%
|
44
46
|
|
45
47
|
// Used only in +smashing-layout
|
46
|
-
=smashing-
|
47
|
-
.
|
48
|
+
=smashing-content
|
49
|
+
.primary, .secondary
|
48
50
|
+box-sizing(border-box)
|
49
51
|
@if $smashing-direction == right
|
50
52
|
+float-left
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smashing-layout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-19 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: compass
|
16
|
-
requirement: &
|
16
|
+
requirement: &70135509786280 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.11.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70135509786280
|
25
25
|
description: A Sass experiment to recreate Smashing Magazine's layout (circa 2009)
|
26
26
|
email: adam@stacoviak.com
|
27
27
|
executables: []
|
@@ -45,7 +45,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: '0'
|
46
46
|
segments:
|
47
47
|
- 0
|
48
|
-
hash:
|
48
|
+
hash: 2416944541092671579
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|