rwdcalc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rwdcalc.rb +6 -0
- data/rwdcalc.gemspec +28 -0
- data/stylesheets/_rwdcalc.scss +63 -0
- metadata +82 -0
data/lib/rwdcalc.rb
ADDED
data/rwdcalc.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "rwdcalc"
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5")
|
8
|
+
s.authors = ["Stuart Robson", "Scott Kellum"]
|
9
|
+
s.email = ["stu@alwaystwisted.com", "scott@scottkellum.com"]
|
10
|
+
s.homepage = "http://rwdcalc.com"
|
11
|
+
|
12
|
+
s.description = ["Create color schemes with ease."]
|
13
|
+
s.summary = ["Create color schemes with ease."]
|
14
|
+
|
15
|
+
s.has_rdoc = false
|
16
|
+
s.files = [
|
17
|
+
"rwdcalc.gemspec",
|
18
|
+
"lib/rwdcalc.rb",
|
19
|
+
"stylesheets/_rwdcalc.scss"
|
20
|
+
]
|
21
|
+
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
s.rubygems_version = ["1.7.2"]
|
24
|
+
|
25
|
+
# Dependent Gems
|
26
|
+
s.add_dependency 'sass', ">= 3.2.1"
|
27
|
+
s.add_dependency 'compass', ">= 0.12.2"
|
28
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// Setup defaults
|
2
|
+
$target: 960 !default;
|
3
|
+
$context: 960 !default;
|
4
|
+
|
5
|
+
|
6
|
+
// Just drop this in if you feel like having box-sizing: border-box.
|
7
|
+
@mixin border-box {
|
8
|
+
* {
|
9
|
+
-moz-box-sizing: border-box;
|
10
|
+
-webkit-box-sizing: border-box;
|
11
|
+
box-sizing: border-box;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
// RWDcalc function converts unitless values to a % of context.
|
16
|
+
@function rwdcalc($target: $target, $values: 0) {
|
17
|
+
|
18
|
+
// start with an empty list of values.
|
19
|
+
$list: ();
|
20
|
+
|
21
|
+
// loop through all possible values in the string (margin, padding and so on can be lists)
|
22
|
+
@each $value in $values {
|
23
|
+
|
24
|
+
// If the value has no unit, consider it a px-% converstion
|
25
|
+
@if unit($value) == "" {
|
26
|
+
$list: append($list, percentage($value / $target), space);
|
27
|
+
}
|
28
|
+
|
29
|
+
// Else pass the value back to the list unchanged.
|
30
|
+
@else {
|
31
|
+
$list: append($list, $value);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
// return the list with unitless values converted.
|
36
|
+
@return $list;
|
37
|
+
}
|
38
|
+
|
39
|
+
@mixin rwdcalc($target: $target, $context: $context, $margin: false, $padding: false, $border: false) {
|
40
|
+
|
41
|
+
// Width is a straight converstion of target/context.
|
42
|
+
width: percentage($target / $context);
|
43
|
+
|
44
|
+
// Margin, padding, and border get converted to % if they are passed in as a unitless value.
|
45
|
+
@if $margin != false {
|
46
|
+
// just pull in the rwdcalc function for these.
|
47
|
+
margin: rwdcalc($target, $margin);
|
48
|
+
}
|
49
|
+
@if $padding != false {
|
50
|
+
padding: rwdcalc($target, $padding);
|
51
|
+
}
|
52
|
+
@if $border != false {
|
53
|
+
@if type-of($border) == list {
|
54
|
+
// Transparent border so metrics get written by default.
|
55
|
+
border: 0 solid transparent;
|
56
|
+
// Write width overrides:
|
57
|
+
border-width: rwdcalc($target, $border);
|
58
|
+
}
|
59
|
+
@else {
|
60
|
+
border: rwdcalc($target, $border) solid transparent;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rwdcalc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Stuart Robson
|
9
|
+
- Scott Kellum
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-10-26 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: sass
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.2.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.2.1
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: compass
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.12.2
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.12.2
|
47
|
+
description: ! '["Create color schemes with ease."]'
|
48
|
+
email:
|
49
|
+
- stu@alwaystwisted.com
|
50
|
+
- scott@scottkellum.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- rwdcalc.gemspec
|
56
|
+
- lib/rwdcalc.rb
|
57
|
+
- stylesheets/_rwdcalc.scss
|
58
|
+
homepage: http://rwdcalc.com
|
59
|
+
licenses: []
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.5
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.8.24
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: ! '["Create color schemes with ease."]'
|
82
|
+
test_files: []
|