gliss-layout 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c48a75fed0a96d5ec476c4acbb3ea18b5c5c5f01
4
+ data.tar.gz: d91c3c43e35541b6af630a2e06e98ded60483f58
5
+ SHA512:
6
+ metadata.gz: 83faa853b0a9a88fbc707013e81ff8af029d42f7d8695964aa53b2fc8cd16b83d6771c55292f1ac1a0a97841c6192c62a2fe95e5d632a7b11e9bfadab474fc84
7
+ data.tar.gz: ccaae1c1a7dbdb77ce6c09c9a21877734ba4eea7a9d9ee595abec84a651d4e04554e1dc2111befd43b2ead401d721b3eeea030c1536e688766cd6d6a08808724
data/changelog.md ADDED
@@ -0,0 +1,3 @@
1
+ # Version 0.0.0
2
+
3
+ Initial release
data/lib/gliss.rb ADDED
@@ -0,0 +1,28 @@
1
+ # All gems that are required for this extension to work should go here.
2
+ # These are the requires you would normally put in your config.rb file
3
+ # By default, you should always included Compass. Do not include your
4
+ # extension.
5
+ require 'compass'
6
+
7
+ # This tells Compass what your Compass extension is called, and where to find
8
+ # its files
9
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
10
+ Compass::Frameworks.register('gliss-layout', :path => extension_path)
11
+
12
+ # Version and date of version for your Compass extension.
13
+ # Replace Gliss with the name of your extension
14
+ # Letters, numbers, and underscores only
15
+ # Version is a number. If a version contains alphas, it will be created as
16
+ # a prerelease version
17
+ # Date is in the form of YYYY-MM-DD
18
+ module Gliss
19
+ VERSION = "0.0.0"
20
+ DATE = "2015-04-06"
21
+ end
22
+
23
+ # This is where any custom SassScript should be placed. The functions will be
24
+ # available on require of your extension without the need for users to import
25
+ # any partials. Uncomment below.
26
+
27
+ # module Sass::Script::Functions
28
+ # end
data/license.md ADDED
@@ -0,0 +1,11 @@
1
+ BSD license
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/readme.md ADDED
@@ -0,0 +1,141 @@
1
+ # Gliss
2
+
3
+ Gliss is a constraint based layout system for articles. It uses the CSS properties `width` and `max-width` instead of media queries to change the layout at different viewport sizes. You can [see a demo here](http://gliss.pgdn.us/), and the [related source code](https://github.com/scottkellum/gliss/blob/master/test-compass/sass/style.scss).
4
+
5
+ ## Getting started
6
+
7
+ ### Install with Compass:
8
+
9
+ In your terminal execute:
10
+
11
+ ```
12
+ gem install gliss-layout
13
+ ```
14
+
15
+ In your `config.rb` file write
16
+
17
+ ```
18
+ require 'gliss'
19
+ ```
20
+
21
+ And finally, import Gliss into your stylesheet
22
+
23
+ ```
24
+ @import 'gliss';
25
+ ```
26
+
27
+ ### Install without Compass:
28
+
29
+ Download the [latest release](https://github.com/scottkellum/gliss/releases).
30
+
31
+ Unzip into your project and import Gliss into your stylesheet
32
+
33
+ ```
34
+ @import 'gliss';
35
+ ```
36
+
37
+ ## Documentation
38
+
39
+ First, you are going to want to configure Gliss. Here are the main variables to define your grid:
40
+
41
+ <table>
42
+ <tr>
43
+ <th>Variable</th><th>Default</th><th>Description</th></tr>
44
+ <tr>
45
+ <td>$max-width</td><td>80rem</td><td>Max width of content container. This must be a fixed width (em, rem or px)</td></tr>
46
+ <tr>
47
+ <td>$gutter</td><td>1rem</td><td>Gutter width, must be same units as $max-width.</td></tr>
48
+ <tr>
49
+ <td>$margin</td><td>4%</td><td>Margins on either side of the content container.</td></tr>
50
+ <tr>
51
+ <td>$cols</td><td>12</td><td>Number of columns the grid is divided into.</td></tr>
52
+ </table>
53
+
54
+ So far this just provides you with a basic toolset, but if you want to have something more out of the box to work with, set `$gliss-modules` to `true` and define these variables as needed:
55
+
56
+ <table>
57
+ <tr>
58
+ <th>Variable</th><th>Default</th><th>Description</th></tr>
59
+ <tr>
60
+ <td>$gliss-modules</td><td>false</td><td>Generates default styles so you can get going with writing markup.</td></tr>
61
+ <tr>
62
+ <td>$gliss-wrapper</td><td>'article'</td><td>The wrapper for the entire article.</td></tr>
63
+ <tr>
64
+ <td>$gliss-text</td><td>'.text'</td><td>A block of text.</td></tr>
65
+ <tr>
66
+ <td>$gliss-figure</td><td>'figure'</td><td>A figure to contain an image, media or graphic that you wish to be floated alongside the main text column.</td></tr>
67
+ </table>
68
+
69
+
70
+ Gliss is primarily designed to help out with math by providing a few mixins that set the width constraints and alignment on elements.
71
+
72
+ The primary mixin you will use is `grid()` and you can pass the small and large constraints to it. If we wanted `foo` to be 6 columns wide at small sizes and 3 columns wide at the largest sizes then we would write it like this:
73
+
74
+ ```scss
75
+ foo {
76
+ @include grid(6,3);
77
+ }
78
+ ```
79
+
80
+ This will generate the following CSS:
81
+
82
+ ```css
83
+ figure._quarter {
84
+ width: 19.25rem;
85
+ max-width: calc(50% + -0.5rem);
86
+ }
87
+ ```
88
+
89
+ For alignment, you can choose left, right, or center by using the following mixins:
90
+
91
+ ```scss
92
+ foo {
93
+ @include grid-center();
94
+ @include grid-left();
95
+ @include grid-right();
96
+ }
97
+ ```
98
+
99
+ If you are generating Gliss modules, then use the module definitions you have created with your variables.
100
+
101
+ First off, the markup should be structure something like this:
102
+
103
+ ```html
104
+ <article>
105
+ <figure></figure>
106
+ <div class="text"></div>
107
+ <figure></figure>
108
+ <div class="text"></div>
109
+ </article>
110
+ ```
111
+
112
+ Gliss figures have a number of modifiers available. `._half`, `._third`, and `._quarter` set elements to be half width, a quarter width, or one third the width of the page at the max width of the layout. All three degrade to half width. `._left` and `._right` will float these figures left or right.
113
+
114
+ `._hang` is an additional figure modifier that will align the figure with the main text column and also push it flush with the side of the article. You can use `._left` and `._right` with hanging figures.
115
+
116
+ This framework is intended as a barebones toolset, not something that will solve all your layout problems for you. It is intended as a beginning to solving some tough problems, not an end and it’s likely that you will find value in reworking components to fit your needs.
117
+
118
+ ## Authors
119
+
120
+ [Scott Kellum](https://github.com/scottkellum)
121
+
122
+ ## Contribute
123
+
124
+ This is an active project and we encourage contributions. [Please review our guidelines and code of conduct before contributing.](https://github.com/voxmedia/open-source-contribution-guidelines)
125
+
126
+ ## License
127
+
128
+ Copyright (c) 2015, Vox Media, Inc.
129
+ All rights reserved.
130
+
131
+ BSD license
132
+
133
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
134
+
135
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
136
+
137
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
138
+
139
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
140
+
141
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,23 @@
1
+ // Max width of content container. This must be a fixed width (em or px)
2
+ $max-width: 80rem !default;
3
+ // Gutter width, must be same units as $max-width.
4
+ $gutter: 1rem !default;
5
+ // Margins on either side of the content container.
6
+ $margin: 4% !default;
7
+ // Number of columns the grid is divided into.
8
+ $cols: 12 !default;
9
+
10
+ // Chose to write gliss classes.
11
+ // By default, only the math tools are avalible.
12
+ // This does a lot of the other work for you.
13
+ $gliss-modules: false !default;
14
+
15
+ // Choose what classes to write for your elements:
16
+ $gliss-wrapper: 'article' !default;
17
+ $gliss-text: '.text' !default;
18
+ $gliss-figure: 'figure' !default;
19
+
20
+
21
+ @import
22
+ 'gliss/core',
23
+ 'gliss/modules';
@@ -0,0 +1,97 @@
1
+ // Non-configurable variables for internal use:
2
+
3
+ // Find the width of the margins within the context of the container
4
+ $margin-inv: (100% / (100 - $margin * 2) * $margin);
5
+
6
+
7
+ // Upper limit for elements on the grid. This is a fixed width.
8
+ @function grid-max(
9
+ $max:$max,
10
+ $cols:$cols,
11
+ $max-width:$max-width,
12
+ $gutter:$gutter
13
+ ) {
14
+
15
+ // Total width of the columns minus the gutters
16
+ $cols-max-width: $max-width - ($gutter * ($cols - 1));
17
+ // Find the max width of a simgle column as a fixed width.
18
+ $col-max-width: ($cols-max-width / $cols);
19
+
20
+ // All the columns plus gutters.
21
+ @return ($col-max-width * $max) + ($gutter * ($max - 1));
22
+ }
23
+
24
+ // The lower constraint, how small can this get?
25
+ @function grid-min(
26
+ $min:$min,
27
+ $cols:$cols,
28
+ $max-width:$max-width,
29
+ $gutter:$gutter
30
+ ) {
31
+
32
+ // Make sure not to divide by zero.
33
+ @if $min < $cols {
34
+ @return calc(#{(100% / $cols) * $min} + #{$gutter * ($min - $cols) / ($cols)});
35
+ }
36
+ @return 100%;
37
+ }
38
+
39
+ @mixin grid(
40
+ $min:false, // Lower limit (compiles to % constraint)
41
+ $max:false, // Upper limit (compiles to fixed constraint)
42
+ $cols:$cols,
43
+ $max-width:$max-width,
44
+ $gutter:$gutter
45
+ ) {
46
+
47
+ // Write max width first as it is mapped to just width.
48
+ @if $max {
49
+ width: grid-max($max,$cols,$max-width,$gutter);
50
+ } @else {
51
+ // If unspecified, use 100% to ensure the min-width is fulled.
52
+ width: 100%;
53
+ }
54
+ // Write min width second.
55
+ // It may seem counter-intuitive that $min is mapped to
56
+ // max-width but it's because as the screen shrinks
57
+ // the elements will hit higher %s.
58
+ // This is the upper bounds on that % but on a smaller screen.
59
+ @if $min {
60
+ max-width: grid-min($min,$cols,$max-width,$gutter);
61
+ }
62
+ }
63
+
64
+
65
+ // Alignment
66
+
67
+ // Center a thing
68
+ @mixin grid-center {
69
+ margin-left: auto;
70
+ margin-right: auto;
71
+ }
72
+
73
+ // Align right
74
+ @mixin grid-right(
75
+ $offset:0
76
+ ) {
77
+
78
+ @if $offset != 0 {
79
+ $offset: calc(#{(100% / $cols) * $offset} + #{($gutter * ($offset - $cols) / ($cols)) + ($gutter)});
80
+ }
81
+
82
+ float: right;
83
+ margin: 0 $offset 0 $gutter;
84
+ }
85
+
86
+ // Align left
87
+ @mixin grid-left(
88
+ $offset:0
89
+ ) {
90
+
91
+ @if $offset != 0 {
92
+ $offset: calc(#{(100% / $cols) * $offset} + #{($gutter * ($offset - $cols) / ($cols)) + ($gutter)});
93
+ }
94
+
95
+ float: left;
96
+ margin: 0 $gutter 0 $offset;
97
+ }
@@ -0,0 +1,58 @@
1
+ @if $gliss-modules {
2
+ #{$gliss-wrapper} {
3
+ padding: 0 $margin;
4
+ margin: 0 auto;
5
+ max-width: $max-width;
6
+ }
7
+
8
+ // Text level elements
9
+ #{$gliss-text} {
10
+ @include grid-center();
11
+ @include grid(12,6);
12
+ body.show-grid & {
13
+ background: rgba(#f00,.1);
14
+ }
15
+ }
16
+
17
+ // figure logic
18
+ #{$gliss-figure} {
19
+ margin: 0 ($margin-inv * -1);
20
+ @media (min-width: ($max-width / 3)) {
21
+ &._quarter {
22
+ @include grid-right();
23
+ @include grid(6,3);
24
+ &._left {
25
+ @include grid-left();
26
+ }
27
+ }
28
+
29
+ &._third {
30
+ @include grid-right();
31
+ @include grid(6,4);
32
+ &._left {
33
+ @include grid-left();
34
+ }
35
+ }
36
+
37
+ &._half {
38
+ @include grid-right();
39
+ @include grid(6);
40
+ &._left {
41
+ @include grid-left();
42
+ }
43
+ }
44
+ &._hang {
45
+ margin: 0 ($margin-inv * -1) 0 0;
46
+ float: right;
47
+ width: calc(
48
+ (100% - #{grid-max(6)}) / 2 + #{$margin-inv} + #{grid-max(6)}
49
+ );
50
+ max-width: 100% + $margin-inv * 2;
51
+ &._left {
52
+ margin: 0 0 0 ($margin-inv * -1);
53
+ float: left;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
Binary file
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gliss-layout
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Scott Kellum
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: compass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.12.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.12.0
27
+ description: Gliss is a system that uses max-width and width to allow elements to
28
+ fall on different grids at different sizes instead of more traditional media queries.
29
+ This allows elements to fluidly change their size instead of snapping to a new grid
30
+ system at various breakpoints.
31
+ email:
32
+ - scott@scottkellum.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files:
36
+ - changelog.md
37
+ - license.md
38
+ - readme.md
39
+ files:
40
+ - changelog.md
41
+ - lib/gliss.rb
42
+ - license.md
43
+ - readme.md
44
+ - stylesheets/_gliss.scss
45
+ - stylesheets/gliss.zip
46
+ - stylesheets/gliss/_core.scss
47
+ - stylesheets/gliss/_modules.scss
48
+ homepage: http://product.voxmedia.com
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.3.6
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.2.2
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: A constraint based responsive grid system.
72
+ test_files: []