compass-layouts 1.0.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.
@@ -0,0 +1 @@
1
+ .sass-cache
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in compass-layouts.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "compass-layouts/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "compass-layouts"
7
+ s.version = Compass::Layouts::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Chris Eppstein"]
10
+ s.email = ["chris@eppsteins.net"]
11
+ s.homepage = "http://chriseppstein.github.com/Compass-Layouts/"
12
+ s.summary = %q{Just enough layout help.}
13
+ s.description = %q{Do not try and bend the grid. That's impossible. Instead... only try to realize the truth: There is no grid. Then you'll see, that it is not the grid that bends; it is only yourself.}
14
+
15
+ s.rubyforge_project = "compass-layouts"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
@@ -0,0 +1,3 @@
1
+ lib_dir = File.expand_path("lib", File.dirname(__FILE__))
2
+ $: << lib_dir unless $:.include?(lib_dir)
3
+ require "compass-layouts"
@@ -0,0 +1,12 @@
1
+ # Require any additional compass plugins here.
2
+ load File.join(File.dirname(__FILE__), "..")
3
+ # Set this to the root of your project when deployed:
4
+ http_path = "/"
5
+ css_dir = "css"
6
+ sass_dir = "sass"
7
+ images_dir = "images"
8
+ javascripts_dir = "javascripts"
9
+ # To enable relative paths to assets via compass helper functions. Uncomment:
10
+ # relative_assets = true
11
+ line_comments = false
12
+ output_style = :compact
@@ -0,0 +1,63 @@
1
+ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; }
2
+
3
+ body { line-height: 1; color: black; background: white; }
4
+
5
+ ol, ul { list-style: none; }
6
+
7
+ table { border-collapse: separate; border-spacing: 0; vertical-align: middle; }
8
+
9
+ caption, th, td { text-align: left; font-weight: normal; vertical-align: middle; }
10
+
11
+ q, blockquote { quotes: "" ""; }
12
+ q:before, q:after, blockquote:before, blockquote:after { content: ""; }
13
+
14
+ a img { border: none; }
15
+
16
+ article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { display: block; }
17
+
18
+ .clearfixed { *zoom: 1; }
19
+ .clearfixed:after { content: "\0020"; display: block; height: 0; clear: both; overflow: hidden; visibility: hidden; }
20
+
21
+ .column, .floated-layout aside, .fixed #page aside, .elastic #page aside, .fluid #page aside, .floated-layout article, .fixed #page article, .elastic #page article, .fluid #page article { display: inline; float: left; }
22
+
23
+ .floated-layout aside, .fixed #page aside, .elastic #page aside, .fluid #page aside, .floated-layout article, .fixed #page article, .elastic #page article, .fluid #page article { width: 33.333%; }
24
+ .floated-layout footer, .fixed #page footer, .elastic #page footer, .fluid #page footer { clear: left; }
25
+
26
+ .boxed-layout, body.box-fixed, body.box-elastic, body.box-fluid { text-align: center; }
27
+ .boxed-layout > *, body.box-fixed > *, body.box-elastic > *, body.box-fluid > * { text-align: left; }
28
+ .boxed-layout > #page, body.box-fixed > #page, body.box-elastic > #page, body.box-fluid > #page { margin-left: auto; margin-right: auto; }
29
+ .boxed-layout #page, body.box-fixed #page, body.box-elastic #page, body.box-fluid #page { display: -moz-box; display: -webkit-box; display: box; -moz-box-orient: vertical; -webkit-box-orient: vertical; box-orient: vertical; -moz-box-align: stretch; -webkit-box-align: stretch; box-align: stretch; }
30
+ .boxed-layout #body, body.box-fixed #body, body.box-elastic #body, body.box-fluid #body { -moz-box-flex: 1; -webkit-box-flex: 1; box-flex: 1; display: block; display: -moz-box; display: -webkit-box; display: box; -moz-box-orient: horizontal; -webkit-box-orient: horizontal; box-orient: horizontal; -moz-box-align: stretch; -webkit-box-align: stretch; box-align: stretch; }
31
+ .boxed-layout aside, body.box-fixed aside, body.box-elastic aside, body.box-fluid aside, .boxed-layout article, body.box-fixed article, body.box-elastic article, body.box-fluid article { -moz-box-flex: 1; -webkit-box-flex: 1; box-flex: 1; display: block; }
32
+
33
+ .fixed #page { width: 960px; margin-left: auto; margin-right: auto; }
34
+
35
+ .elastic #page { min-width: 640px; max-width: 1100px; margin-left: auto; margin-right: auto; }
36
+
37
+ body.box-fixed #page { width: 960px; }
38
+
39
+ body.box-elastic #page { min-width: 640px; max-width: 1100px; width: 100%; }
40
+
41
+ body.box-fluid #page { width: 100%; }
42
+
43
+ @media screen and (max-width: 500px) { .floated-layout aside, .fixed #page aside, .elastic #page aside, .fluid #page aside, .floated-layout article, .fixed #page article, .elastic #page article, .fluid #page article { float: none; width: auto; margin-left: auto; margin-right: auto; display: block; }
44
+ .boxed-layout #body, body.box-fixed #body, body.box-elastic #body, body.box-fluid #body { display: -moz-box; display: -webkit-box; display: box; -moz-box-orient: vertical; -webkit-box-orient: vertical; box-orient: vertical; -moz-box-align: stretch; -webkit-box-align: stretch; box-align: stretch; } }
45
+
46
+ @media screen and (min-width: 800px) { .fluid #page aside { width: 25%; }
47
+ .fluid #page article { width: 50%; }
48
+ body.box-fluid article { -moz-box-flex: 2; -webkit-box-flex: 2; box-flex: 2; display: block; } }
49
+
50
+ @media screen and (min-width: 1000px) { .fluid #page aside { width: 20%; }
51
+ .fluid #page article { width: 60%; }
52
+ body.box-fluid article { -moz-box-flex: 3; -webkit-box-flex: 3; box-flex: 3; display: block; } }
53
+
54
+ @media screen and (min-width: 1200px) { .fluid #page aside { width: 16.667%; }
55
+ .fluid #page article { width: 66.667%; }
56
+ body.box-fluid article { -moz-box-flex: 4; -webkit-box-flex: 4; box-flex: 4; display: block; } }
57
+
58
+ /* For demonstration purposes */
59
+ header, footer { min-height: 200px; background-color: #959908; }
60
+
61
+ aside { min-height: 400px; background-color: #992326; }
62
+
63
+ article { min-height: 600px; background-color: #373B99; }
@@ -0,0 +1,35 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <title>Compass Layouts Demo</title>
5
+ <link rel="stylesheet" href="css/demo.css" type="text/css" media="screen">
6
+ </head>
7
+ <body class="fixed">
8
+ <div id="page">
9
+ <header>
10
+ This is the header.
11
+ <select onchange="document.body.className=this.value;">
12
+ <option value="fixed">floated fixed</option>
13
+ <option value="elastic">floated elastic</option>
14
+ <option value="fluid">floated fluid</option>
15
+ <option value="box-fixed">box fixed</option>
16
+ <option value="box-elastic">box elastic</option>
17
+ <option value="box-fluid">box fluid</option>
18
+ </select>
19
+ </header>
20
+ <div id="body">
21
+ <aside class="nav">
22
+ Left Side Nav
23
+ </aside>
24
+ <article>
25
+ This is the main content
26
+ </article>
27
+ <aside class="callout">
28
+ Right Side callout
29
+ </aside>
30
+ </div>
31
+ <footer>
32
+ This is the footer.
33
+ </footer>
34
+ </body>
35
+ </html>
@@ -0,0 +1,115 @@
1
+ @import "compass/layout/floated";
2
+ @import "compass/layout/box";
3
+ @import "compass/reset";
4
+
5
+ @include reset-html5;
6
+
7
+ // Some base classes for conciseness.
8
+ .clearfixed { @include pie-clearfix; }
9
+ .column { @include floated(left, 0, 0); }
10
+
11
+ // A base class for our floated layouts
12
+ .floated-layout {
13
+ aside { @extend .column; }
14
+ article { @extend .column; }
15
+ aside, article { width: 33.333%; }
16
+ footer { clear: left; }
17
+ }
18
+
19
+ // A base class for our boxed layouts
20
+ .boxed-layout {
21
+ @include centered-box-container("#page");
22
+ #page { @include flexbox(vertical); }
23
+ #body { @include liquid; @include flexbox(horizontal); }
24
+ aside,
25
+ article { @include liquid; }
26
+ }
27
+
28
+ // A fixed width layout
29
+ .fixed #page {
30
+ width: 960px;
31
+ @include centered;
32
+ @extend .floated-layout;
33
+ }
34
+
35
+ // An elastic layout
36
+ .elastic #page {
37
+ min-width: 640px;
38
+ max-width: 1100px;
39
+ @include centered;
40
+ @extend .floated-layout;
41
+ }
42
+
43
+ // A fluid layout (full width)
44
+ .fluid #page {
45
+ @extend .floated-layout;
46
+ }
47
+
48
+ // a fixed box layout
49
+ body.box-fixed {
50
+ @extend .boxed-layout;
51
+ #page { width: 960px; }
52
+ }
53
+
54
+ // an elastic box layout
55
+ body.box-elastic {
56
+ @extend .boxed-layout;
57
+ #page { min-width: 640px; max-width: 1100px; width: 100%;}
58
+ }
59
+
60
+ // a fluid box layout
61
+ body.box-fluid {
62
+ @extend .boxed-layout;
63
+ #page { width: 100%; }
64
+ }
65
+
66
+ // Respond to browser resizing to keep the layout readable
67
+ @media screen and (max-width: 500px) {
68
+ .floated-layout {
69
+ aside, article { @include sunken; display: block; }
70
+ }
71
+ .boxed-layout {
72
+ #body { @include flexbox(vertical); }
73
+ }
74
+ }
75
+
76
+ @media screen and (min-width: 800px) {
77
+ .fluid #page {
78
+ // with a floated layout we have to recalculate all float proportions
79
+ aside { width: percentage(1/4); }
80
+ article { width: percentage(2/4); }
81
+ }
82
+ body.box-fluid {
83
+ // with a box layout, the proportions are recalculated automatically.
84
+ // The article will be twice the width of the asides.
85
+ article { @include liquid(2); }
86
+ }
87
+ }
88
+
89
+ @media screen and (min-width: 1000px) {
90
+ .fluid #page {
91
+ aside { width: percentage(1/5); }
92
+ article { width: percentage(3/5); }
93
+ }
94
+ body.box-fluid {
95
+ // The article will be three times the width of the asides.
96
+ article { @include liquid(3); }
97
+ }
98
+ }
99
+
100
+ @media screen and (min-width: 1200px) {
101
+ .fluid #page {
102
+ aside { width: percentage(1/6); }
103
+ article { width: percentage(4/6); }
104
+ }
105
+ body.box-fluid {
106
+ // The article will be four times the width of the asides.
107
+ article { @include liquid(4); }
108
+ }
109
+ }
110
+
111
+ /* For demonstration purposes */
112
+ header,
113
+ footer { min-height: 200px; background-color: #959908; }
114
+ aside { min-height: 400px; background-color: #992326; }
115
+ article { min-height: 600px; background-color: #373B99; }
@@ -0,0 +1,13 @@
1
+ module Compass
2
+ module Layouts
3
+ end
4
+ end
5
+
6
+ %w(version).each do |f|
7
+ require "compass-layouts/#{f}"
8
+ end
9
+
10
+ Compass::Frameworks.register(
11
+ "compass-layouts",
12
+ File.expand_path("..", File.dirname(__FILE__))
13
+ )
@@ -0,0 +1,5 @@
1
+ module Compass
2
+ module Layouts
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,47 @@
1
+ @import "compass/css3/box";
2
+ @import "shared";
3
+
4
+ // this is an experimental layout module
5
+ // based on the new box layout module in css3
6
+ // it is not fully supported by all browsers
7
+ // and will not degrade particularly gracefully
8
+ // unless you take some action to do so.
9
+
10
+ // $orientation - One of: horizontal, vertical
11
+ // $align - One of: start, end, center, baseline, stretch (default)
12
+ @mixin flexbox($orientation: $default-box-orient, $align: $default-box-align) {
13
+ @include display-box;
14
+ @include box-orient($orientation);
15
+ @include box-align($align);
16
+ }
17
+
18
+ // Distribute the children of the box. This is an alias for box-pack.
19
+ // Can be one of `start`, `end`, `center`, `justify`
20
+ @mixin distribute-children($distribute) {
21
+ @include box-pack($distribute);
22
+ }
23
+
24
+ // Makes a box liquid (relative to the box container)
25
+ // The remaining space that is left after the fixed with
26
+ // boxes is distributed proportionally across the liquid
27
+ // elements according to the $size parameter which must be
28
+ // a positive integer.
29
+ @mixin liquid($size: 1) {
30
+ @if $size == none {
31
+ $size: 0;
32
+ }
33
+ @include box-flex($size);
34
+ }
35
+
36
+ // Mix this into the element that contains the flexbox
37
+ // to make the box container centered (probably the body element).
38
+ // $box - the selector that identifies the flexbox.
39
+ @mixin centered-box-container($box) {
40
+ text-align: center;
41
+ > * {
42
+ text-align: left;
43
+ }
44
+ > #{$box} {
45
+ @include centered;
46
+ }
47
+ }
@@ -0,0 +1,106 @@
1
+ @import "compass/utilities/general/float";
2
+ @import "compass/utilities/general/clearfix";
3
+ @import "shared";
4
+
5
+ // Direction of the float
6
+ $compass-float-direction: left !default;
7
+ // Set to 0 to disable gutters
8
+ $compass-gutter-width: 10px !default;
9
+ $compass-left-gutter-width: ceil($compass-gutter-width / 2) !default;
10
+ $compass-right-gutter-width: $compass-gutter-width - $compass-left-gutter-width !default;
11
+
12
+ // A floated element is generally assigned a width to achieve table-less alignment
13
+ @mixin floated($side : $compass-float-direction,
14
+ $left-gutter : $compass-left-gutter-width,
15
+ $right-gutter : $compass-right-gutter-width) {
16
+ @include float($side);
17
+ @if $left-gutter > 0 {
18
+ margin-left: $left-gutter;
19
+ }
20
+ @if $right-gutter > 0 {
21
+ margin-right: $right-gutter;
22
+ }
23
+ }
24
+
25
+ // Remove the gutter for a particular side of a floated element
26
+ // pass `both` to disable the gutter on both sides.
27
+ @mixin gutterless($side) {
28
+ @if $side == both {
29
+ margin-left: 0;
30
+ margin-right: 0;
31
+ } @else {
32
+ margin-#{$side}: 0;
33
+ }
34
+ }
35
+
36
+ // provides the base structure required to make an element pushable in
37
+ // the specified direction (which defaults to `right`).
38
+ @mixin pushable($side: opposite-position($compass-float-direction)) {
39
+ @include float($side);
40
+ position: relative;
41
+ }
42
+
43
+ // provides the base structure required to make an element pullable in
44
+ // the specified direction (which defaults to `left`).
45
+ @mixin pullable($side : $compass-float-direction) {
46
+ @include float($side);
47
+ position: relative;
48
+ }
49
+
50
+ // push an element in the specified direction by the specified amount.
51
+ @mixin pushed($side, $amount) {
52
+ margin-#{$side}: -$amount;
53
+ margin-#{opposite-position($side)}: $amount;
54
+ }
55
+
56
+ // pull an element in the specified directionn by the specified amount.
57
+ @mixin pulled($side, $amount) {
58
+ margin-#{$side}: $amount;
59
+ }
60
+
61
+ // Take an element out of the float if it had been made floated already.
62
+ // This might be applied to an element to allow it to fill the remainder
63
+ // of a row, in which case you'll probably want to make that element also
64
+ // a float container.
65
+ @mixin sunken {
66
+ float: none;
67
+ width: auto;
68
+ margin-left: auto;
69
+ margin-right: auto;
70
+ }
71
+
72
+ @mixin act-like-blueprint {
73
+ .clearfixed { @include pie-clearfix; }
74
+ .column { @include floated(left, 0, $compass-gutter-width); }
75
+ .last { @include gutterless(right); }
76
+ .float-container { @extend .clearfixed; }
77
+ .container { @extend .float-container; @include centered; }
78
+ .push { @include pushable; }
79
+ .pull { @include pullable; }
80
+ }
81
+
82
+ @mixin act-like-960 {
83
+ .clearfixed { @include pie-clearfix; }
84
+ .grid { @include floated(left, $compass-gutter-left-width, $compass-gutter-right-width); }
85
+ .alpha { @include gutterless(left); }
86
+ .omega { @include gutterless(right); }
87
+ .container { @extend .clearfixed; }
88
+ .grid-container { @extend .container; @include centered; }
89
+ .push { @include pushable; }
90
+ .pull { @include pullable; }
91
+ }
92
+
93
+ @mixin act-like-oocss {
94
+ .clearfixed { @include pie-clearfix; }
95
+ .line { @extend .clearfixed; }
96
+ .unit { @include floated(left, 0, 0); }
97
+ .lastUnit { @extend .clearfixed; @include sunken; }
98
+ .size1of1 { @include sunken; }
99
+
100
+ @for $divisions from 2 through 5 {
101
+ @for $segment from 1 to $divisions {
102
+ .size#{$segment}of#{$divisions} { width: percentage($segment / $divisions); }
103
+ }
104
+ }
105
+ }
106
+
@@ -0,0 +1,8 @@
1
+ // make an element centered within its fixed-width parent.
2
+ // Can be applied to a top level float container to create
3
+ // a centered layout within the window.
4
+ @mixin centered {
5
+ margin-left: auto;
6
+ margin-right: auto;
7
+ }
8
+
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-layouts
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Chris Eppstein
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-05 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: "Do not try and bend the grid. That's impossible. Instead... only try to realize the truth: There is no grid. Then you'll see, that it is not the grid that bends; it is only yourself."
23
+ email:
24
+ - chris@eppsteins.net
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - compass-layouts.gemspec
36
+ - compass_init.rb
37
+ - demo/config.rb
38
+ - demo/css/demo.css
39
+ - demo/demo.html
40
+ - demo/sass/demo.scss
41
+ - lib/compass-layouts.rb
42
+ - lib/compass-layouts/version.rb
43
+ - stylesheets/compass/layout/_box.scss
44
+ - stylesheets/compass/layout/_floated.scss
45
+ - stylesheets/compass/layout/_shared.scss
46
+ has_rdoc: true
47
+ homepage: http://chriseppstein.github.com/Compass-Layouts/
48
+ licenses: []
49
+
50
+ post_install_message:
51
+ rdoc_options: []
52
+
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ requirements: []
74
+
75
+ rubyforge_project: compass-layouts
76
+ rubygems_version: 1.6.2
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: Just enough layout help.
80
+ test_files: []
81
+