csstainable_grid 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/README.md +32 -0
- data/bin/csstainable_grid.rb +14 -0
- data/csstainable_grid.gemspec +17 -0
- data/lib/csstainable_grid.rb +3 -0
- data/lib/csstainable_grid/csstainable_generate.rb +81 -0
- data/source/_csstainable_grid.sass +79 -0
- data/source/_csstainable_library.sass +102 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 33130f0382b30eb242783c5d0103f70ff057b86e
|
4
|
+
data.tar.gz: cf1ecd47d3bb73d37d7675c8a0a7cf1d7a517490
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b7779a9b6d98a58bb2e330612c6005f9464c78fff42faa3c82aeb88cc0097b29d25a0cec0f9e923ecfc3af4e00de9e8d9967dece5267c68618c5ba72151000a
|
7
|
+
data.tar.gz: e10934dc3154cde7a5068d7a82949efe44ed36cdaed61659899ba8f50ab1128fe8c7e722a961b2451f2bf9527d350918b3880e1059c360c29223edbf36838fb8
|
data/.gitignore
ADDED
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# csstainable grid
|
2
|
+
Generate a world-class SASS grid from the command line.
|
3
|
+
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
Install the gem and run the generator
|
7
|
+
|
8
|
+
```
|
9
|
+
gem install 'csstainable_grid'
|
10
|
+
```
|
11
|
+
|
12
|
+
Then, run the generator with the paths it needs (see Options below)
|
13
|
+
|
14
|
+
```
|
15
|
+
csstainable_grid --columns 24 --sass-library-dir . --sass-grid-dir .
|
16
|
+
```
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
### Required Options
|
21
|
+
You must specifiy path folders where the two files will generate.
|
22
|
+
|
23
|
+
* --sass-library-dir - place this file where you @import other variables and mixins (does not render CSS)
|
24
|
+
* --sass-grid-dir - place this in the @import structure where you have other CSS declarations.
|
25
|
+
|
26
|
+
I strongly suggest you always separate your non-rending SASS (variables and mixins) from your rendering SASS (CSS declarations and placeholders).
|
27
|
+
|
28
|
+
### What it generates
|
29
|
+
The two files that compose the grid:
|
30
|
+
|
31
|
+
* _library.sass - the variables and mixins to generate the grid
|
32
|
+
* _grid.sass - grid classes for use in markup
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'csstainable_grid'
|
4
|
+
|
5
|
+
class CsstainableGridExecutable
|
6
|
+
def CsstainableGridExecutable.call_generator(args = ['12', '--sass_library_dir','.','--sass_grid_dir','.'])
|
7
|
+
executable_file = File.join(File.expand_path("../../.", __FILE__), 'lib', 'csstainable_grid', 'csstainable_generate.rb')
|
8
|
+
executable_command = "ruby #{executable_file} #{args.join(' ')}"
|
9
|
+
|
10
|
+
exec executable_command
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
CsstainableGridExecutable.call_generator(ARGV)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'csstainable_grid'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.licenses = ['MIT']
|
5
|
+
s.summary = 'A sustainable SASS grid.'
|
6
|
+
s.description = 'Generate a world-class SASS grid from the command line.'
|
7
|
+
s.authors = ['wardpenney']
|
8
|
+
s.email = 'csstainable@gmail.com'
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.homepage = 'https://github.com/wardpenney/csstainable_grid'
|
11
|
+
|
12
|
+
|
13
|
+
s.add_dependency 'thor'
|
14
|
+
s.add_dependency 'linguistics'
|
15
|
+
|
16
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'linguistics'
|
3
|
+
|
4
|
+
class CsstainableGenerate < Thor
|
5
|
+
Linguistics.use( :en )
|
6
|
+
|
7
|
+
desc "csstainable_grid", "A fresh hot csstainable grid"
|
8
|
+
option :columns, :required => true, :type => :numeric, :aliases => :c
|
9
|
+
option :sass_library_dir, :required => true, :type => :string, :aliases => :l
|
10
|
+
option :sass_grid_dir, :required => true, :type => :string, :aliases => :g
|
11
|
+
long_desc <<-LONGDESC
|
12
|
+
|
13
|
+
Call with -columns [-c] --sass_library_dir [-l] --sass_grid_dir [-g]
|
14
|
+
|
15
|
+
Get two SASS files for your grid:
|
16
|
+
csstainable library: mixins, variables and other non-rendering SASS
|
17
|
+
csstainable grid: the grid and other rendering SASS
|
18
|
+
|
19
|
+
How many columns you want?
|
20
|
+
|
21
|
+
LONGDESC
|
22
|
+
|
23
|
+
def csstainable_grid
|
24
|
+
columns = options[:columns].to_i
|
25
|
+
puts "Baking one grid of #{columns} columns..."
|
26
|
+
|
27
|
+
path_library = File.expand_path(File.join(options[:sass_library_dir], '_csstainable_library.sass'))
|
28
|
+
path_grid = File.expand_path(File.join(options[:sass_grid_dir], '_csstainable_grid.sass'))
|
29
|
+
|
30
|
+
puts "Building _csstainable_library.sass"
|
31
|
+
FileUtils.mkdir_p(File.dirname(path_library))
|
32
|
+
File.open(path_library, 'w') do |library|
|
33
|
+
to_append = File.read("source/_csstainable_library.sass")
|
34
|
+
library.puts to_append
|
35
|
+
|
36
|
+
output = []
|
37
|
+
|
38
|
+
columns.times.each do |c|
|
39
|
+
c = c+1
|
40
|
+
|
41
|
+
output << "\n// GRID COLUMNS #{c} of #{columns}"
|
42
|
+
c.times.each do |i|
|
43
|
+
i = i+1
|
44
|
+
|
45
|
+
output << "=cg-col-#{i.en.numwords}-#{c.en.ordinate}s"
|
46
|
+
output << " +cg-col(#{i}, #{c})"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
output << "\n"
|
50
|
+
|
51
|
+
puts "Writing library.sass"
|
52
|
+
library.puts output.join("\n")
|
53
|
+
end
|
54
|
+
|
55
|
+
puts "Building _csstainable_grid.sass"
|
56
|
+
File.open(path_grid, 'w') do |grid|
|
57
|
+
to_append = File.read("source/_csstainable_grid.sass")
|
58
|
+
grid.puts to_append
|
59
|
+
|
60
|
+
output = []
|
61
|
+
|
62
|
+
columns.times.each do |c|
|
63
|
+
c = c+1
|
64
|
+
|
65
|
+
output << "\n// GRID COLUMNS #{c} of #{columns}"
|
66
|
+
c.times.each do |i|
|
67
|
+
i = i+1
|
68
|
+
|
69
|
+
output << ".cg-col-#{i.en.numwords}-#{c.en.ordinate}s"
|
70
|
+
output << " +cg-col-#{i.en.numwords}-#{c.en.ordinate}s"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
output << "\n"
|
74
|
+
|
75
|
+
puts "Writing grid.sass"
|
76
|
+
grid.puts output.join("\n")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
CsstainableGenerate.start(ARGV)
|
@@ -0,0 +1,79 @@
|
|
1
|
+
//
|
2
|
+
// CSSTAINABLE GRID
|
3
|
+
//
|
4
|
+
|
5
|
+
// CSSTAINABLE UTILITIES
|
6
|
+
.cg-clear
|
7
|
+
+cg-clear
|
8
|
+
|
9
|
+
// CSSTAINABLE PADDING
|
10
|
+
.cg-pad-around
|
11
|
+
+cg-pad-around
|
12
|
+
.cg-pad-top
|
13
|
+
+cg-pad-top
|
14
|
+
.cg-pad-right
|
15
|
+
+cg-pad-right
|
16
|
+
.cg-pad-bottom
|
17
|
+
+cg-pad-bottom
|
18
|
+
.cg-pad-left
|
19
|
+
+cg-pad-left
|
20
|
+
.cg-pad-top-double
|
21
|
+
+cg-pad-top-double
|
22
|
+
.cg-pad-right-double
|
23
|
+
+cg-pad-right-double
|
24
|
+
.cg-pad-bottom-double
|
25
|
+
+cg-pad-bottom-double
|
26
|
+
.cg-pad-left-double
|
27
|
+
+cg-pad-left-double
|
28
|
+
.cg-pad-top-triple
|
29
|
+
+cg-pad-top-triple
|
30
|
+
.cg-pad-right-triple
|
31
|
+
+cg-pad-right-triple
|
32
|
+
.cg-pad-bottom-triple
|
33
|
+
+cg-pad-bottom-triple
|
34
|
+
.cg-pad-left-triple
|
35
|
+
+cg-pad-left-triple
|
36
|
+
|
37
|
+
// CSSTAINABLE MARGIN
|
38
|
+
.cg-margin-around
|
39
|
+
+cg-margin-around
|
40
|
+
.cg-margin-top
|
41
|
+
+cg-margin-top
|
42
|
+
.cg-margin-right
|
43
|
+
+cg-margin-right
|
44
|
+
.cg-margin-bottom
|
45
|
+
+cg-margin-bottom
|
46
|
+
.cg-margin-left
|
47
|
+
+cg-margin-left
|
48
|
+
.cg-margin-top-double
|
49
|
+
+cg-margin-top-double
|
50
|
+
.cg-margin-right-double
|
51
|
+
+cg-margin-right-double
|
52
|
+
.cg-margin-bottom-double
|
53
|
+
+cg-margin-bottom-double
|
54
|
+
.cg-margin-left-double
|
55
|
+
+cg-margin-left-double
|
56
|
+
.cg-margin-top-triple
|
57
|
+
+cg-margin-top-triple
|
58
|
+
.cg-margin-right-triple
|
59
|
+
+cg-margin-right-triple
|
60
|
+
.cg-margin-bottom-triple
|
61
|
+
+cg-margin-bottom-triple
|
62
|
+
.cg-margin-left-triple
|
63
|
+
+cg-margin-left-triple
|
64
|
+
|
65
|
+
// CSSTAINABLE GRID CONTAINER
|
66
|
+
.cg-container
|
67
|
+
+cg-container
|
68
|
+
|
69
|
+
// CSSTAINABLE GRID ROW
|
70
|
+
.cg-row
|
71
|
+
+cg-row
|
72
|
+
|
73
|
+
// CSSTAINABLE GRID COLUMNS STANDARD
|
74
|
+
.cg-one-whole
|
75
|
+
+cg-one-whole
|
76
|
+
.cg-one-half
|
77
|
+
+cg-one-half
|
78
|
+
|
79
|
+
// CSSTAINABLE GRID COLUMNS
|
@@ -0,0 +1,102 @@
|
|
1
|
+
//
|
2
|
+
// CSSTAINABLE SETTINGS
|
3
|
+
//
|
4
|
+
$csstainable-max-site-width: 960px
|
5
|
+
$gutter: 10px
|
6
|
+
|
7
|
+
// CSSTAINABLE UTILITIES
|
8
|
+
=cg-clear
|
9
|
+
clear: both
|
10
|
+
&:after
|
11
|
+
content: " "
|
12
|
+
display: block
|
13
|
+
height: 0
|
14
|
+
font-size: 0
|
15
|
+
clear: both
|
16
|
+
visibility: hidden
|
17
|
+
|
18
|
+
// CSSTAINABLE PADDING
|
19
|
+
=cg-pad-around
|
20
|
+
padding-top: $gutter
|
21
|
+
padding-right: $gutter
|
22
|
+
padding-bottom: $gutter
|
23
|
+
padding-left: $gutter
|
24
|
+
=cg-pad-top
|
25
|
+
padding-top: $gutter
|
26
|
+
=cg-pad-right
|
27
|
+
padding-right: $gutter
|
28
|
+
=cg-pad-bottom
|
29
|
+
padding-bottom: $gutter
|
30
|
+
=cg-pad-left
|
31
|
+
padding-left: $gutter
|
32
|
+
=cg-pad-top-double
|
33
|
+
padding-top: $gutter * 2
|
34
|
+
=cg-pad-right-double
|
35
|
+
padding-right: $gutter * 2
|
36
|
+
=cg-pad-bottom-double
|
37
|
+
padding-bottom: $gutter * 2
|
38
|
+
=cg-pad-left-double
|
39
|
+
padding-left: $gutter * 2
|
40
|
+
=cg-pad-top-triple
|
41
|
+
padding-top: $gutter * 3
|
42
|
+
=cg-pad-right-triple
|
43
|
+
padding-right: $gutter * 3
|
44
|
+
=cg-pad-bottom-triple
|
45
|
+
padding-bottom: $gutter * 3
|
46
|
+
=cg-pad-left-triple
|
47
|
+
padding-left: $gutter * 3
|
48
|
+
|
49
|
+
// CSSTAINABLE MARGIN
|
50
|
+
=cg-margin-around
|
51
|
+
margin-top: $gutter
|
52
|
+
margin-right: $gutter
|
53
|
+
margin-bottom: $gutter
|
54
|
+
margin-left: $gutter
|
55
|
+
=cg-margin-top
|
56
|
+
margin-top: $gutter
|
57
|
+
=cg-margin-right
|
58
|
+
margin-right: $gutter
|
59
|
+
=cg-margin-bottom
|
60
|
+
margin-bottom: $gutter
|
61
|
+
=cg-margin-left
|
62
|
+
margin-left: $gutter
|
63
|
+
=cg-margin-top-double
|
64
|
+
margin-top: $gutter * 2
|
65
|
+
=cg-margin-right-double
|
66
|
+
margin-right: $gutter * 2
|
67
|
+
=cg-margin-bottom-double
|
68
|
+
margin-bottom: $gutter * 2
|
69
|
+
=cg-margin-left-double
|
70
|
+
margin-left: $gutter * 2
|
71
|
+
=cg-margin-top-triple
|
72
|
+
margin-top: $gutter * 3
|
73
|
+
=cg-margin-right-triple
|
74
|
+
margin-right: $gutter * 3
|
75
|
+
=cg-margin-bottom-triple
|
76
|
+
margin-bottom: $gutter * 3
|
77
|
+
=cg-margin-left-triple
|
78
|
+
margin-left: $gutter * 3
|
79
|
+
|
80
|
+
// CSSTAINABLE GRID CONTAINER
|
81
|
+
=cg-container
|
82
|
+
max-width: $csstainable-max-site-width
|
83
|
+
margin: 0 auto
|
84
|
+
|
85
|
+
// CSSTAINABLE GRID ROW
|
86
|
+
=cg-row
|
87
|
+
width: 100%
|
88
|
+
|
89
|
+
// CSSTAINABLE GRID COLUMNS
|
90
|
+
=cg-col($col-width, $col-count)
|
91
|
+
width: percentage($col-width / $col-count)
|
92
|
+
min-height: 1px
|
93
|
+
float: left
|
94
|
+
position: relative
|
95
|
+
|
96
|
+
// CSSTAINABLE GRID COLUMNS STANDARD
|
97
|
+
=cg-one-whole
|
98
|
+
+cg-col(1, 1)
|
99
|
+
=cg-one-half
|
100
|
+
+cg-col(1, 2)
|
101
|
+
|
102
|
+
// CSSTAINABLE GRID COLUMNS
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: csstainable_grid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- wardpenney
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: linguistics
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Generate a world-class SASS grid from the command line.
|
42
|
+
email: csstainable@gmail.com
|
43
|
+
executables:
|
44
|
+
- csstainable_grid.rb
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- README.md
|
50
|
+
- bin/csstainable_grid.rb
|
51
|
+
- csstainable_grid.gemspec
|
52
|
+
- lib/csstainable_grid.rb
|
53
|
+
- lib/csstainable_grid/csstainable_generate.rb
|
54
|
+
- source/_csstainable_grid.sass
|
55
|
+
- source/_csstainable_library.sass
|
56
|
+
homepage: https://github.com/wardpenney/csstainable_grid
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.2.1
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: A sustainable SASS grid.
|
80
|
+
test_files: []
|