modular-scale 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/modular-scale.rb CHANGED
@@ -3,7 +3,7 @@ Compass::Frameworks.register("modular-scale", :path => "#{File.dirname(__FILE__)
3
3
 
4
4
  module ModularScale
5
5
 
6
- VERSION = "0.0.3"
7
- DATE = "2011-08-14"
6
+ VERSION = "0.0.4"
7
+ DATE = "2011-09-15"
8
8
 
9
9
  end
@@ -1,3 +1,6 @@
1
+ // SASSY MODULAR-SCALE
2
+ // https://github.com/scottkellum/modular-scale
3
+
1
4
  // Ratios
2
5
  $golden: 1.618
3
6
  $octave: (2 / 1)
@@ -32,19 +35,27 @@ $class-slug: ms !default
32
35
  // and multiple ratios are passed in as a list
33
36
  // calculate values in using each base-size / ratio combination
34
37
  @if type-of($base-size) == 'list' and type-of($ratio) == 'list'
38
+ @if unit(ms-multibase-multiratio($multiple, $base-size, $ratio)) == 'px'
39
+ @return round(ms-multibase-multiratio($multiple, $base-size, $ratio))
35
40
  @return ms-multibase-multiratio($multiple, $base-size, $ratio)
36
41
 
37
42
  // if multiple base-sizes are passed in as a list
38
43
  // calculate values in using each base-size
39
44
  @if type-of($base-size) == 'list' and type-of($ratio) == 'number'
45
+ @if unit(ms-multibase($multiple, $base-size, $ratio)) == 'px'
46
+ @return round(ms-multibase($multiple, $base-size, $ratio))
40
47
  @return ms-multibase($multiple, $base-size, $ratio)
41
48
 
42
49
  // if multiple ratios are passed in as a list
43
50
  // calculate values in using each ratio
44
51
  @if type-of($base-size) == 'number' and type-of($ratio) == 'list'
52
+ @if unit(ms-multiratio($multiple, $base-size, $ratio)) == 'px'
53
+ @return round(ms-multiratio($multiple, $base-size, $ratio))
45
54
  @return ms-multiratio($multiple, $base-size, $ratio)
46
55
 
47
56
  // If there are no lists just run the simple function
57
+ @if unit(exponent($ratio, $multiple) * $base-size) == 'px'
58
+ @return round(exponent($ratio, $multiple) * $base-size)
48
59
  @return exponent($ratio, $multiple) * $base-size
49
60
 
50
61
 
@@ -200,8 +211,10 @@ $class-slug: ms !default
200
211
  @return modular-scale($multiple, $base-size, $ratio)
201
212
 
202
213
  // Mixin
214
+ // Deprecated. Use the modular-scale() function instead
203
215
  =modular-scale($property, $multiple, $base-size, $ratio)
204
216
  // Print the $property and return the value from the Modular Scale function
217
+ @warn "The modular-scale mixin is deprecated. Instead use the function: width: modular-scale(3)"
205
218
  #{$property}: modular-scale($multiple, $base-size, $ratio)
206
219
 
207
220
  // Classes Mixin
@@ -209,7 +222,9 @@ $class-slug: ms !default
209
222
  // Loop from 0 through the value of $multiple and generate a range of classes
210
223
  @for $i from 0 through $multiple
211
224
  .#{$class-slug}-#{$i}
212
- +modular-scale($property, $i, $base-size, $ratio)
225
+ // Print the $property and return the value from the Modular Scale function
226
+ #{$property}: modular-scale($i, $base-size, $ratio)
227
+
213
228
 
214
229
  /////////////////////////////////////////////////////////////////////////
215
230
 
metadata CHANGED
@@ -1,74 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: modular-scale
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
4
5
  prerelease:
5
- version: 0.0.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Scott Kellum
9
9
  - Adam Stacoviak
10
10
  - Mason Wendell
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
-
15
- date: 2011-08-14 00:00:00 Z
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
14
+ date: 2011-09-15 00:00:00.000000000Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
18
17
  name: compass
19
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: &70224884013320 !ruby/object:Gem::Requirement
20
19
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
24
23
  version: 0.11.5
25
24
  type: :runtime
26
25
  prerelease: false
27
- version_requirements: *id001
28
- description: Sassy Modular Scale calculates the incremental values of the modular scale.
29
- email:
26
+ version_requirements: *70224884013320
27
+ description: Sassy Modular Scale calculates the incremental values of the modular
28
+ scale.
29
+ email:
30
30
  - scott@scottkellum.com
31
31
  - adam@stacoviak.com
32
32
  - mason@zivtech.com
33
33
  executables: []
34
-
35
34
  extensions: []
36
-
37
35
  extra_rdoc_files: []
38
-
39
- files:
36
+ files:
40
37
  - README.mdown
41
38
  - lib/modular-scale.rb
42
39
  - stylesheets/_modular-scale.sass
43
40
  homepage: https://github.com/scottkellum/modular-scale
44
41
  licenses: []
45
-
46
42
  post_install_message:
47
43
  rdoc_options: []
48
-
49
- require_paths:
44
+ require_paths:
50
45
  - lib
51
- required_ruby_version: !ruby/object:Gem::Requirement
46
+ required_ruby_version: !ruby/object:Gem::Requirement
52
47
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 2683294284608242582
57
- segments:
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ segments:
58
53
  - 0
59
- version: "0"
60
- required_rubygems_version: !ruby/object:Gem::Requirement
54
+ hash: 599198530152420284
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
56
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
65
60
  version: 1.3.6
66
61
  requirements: []
67
-
68
62
  rubyforge_project:
69
- rubygems_version: 1.8.7
63
+ rubygems_version: 1.8.10
70
64
  signing_key:
71
65
  specification_version: 3
72
- summary: Sassy Modular Scale calculates the incremental values of the modular scale in proportion to a set size and ratio. Inspired by and adapted from Tim Brown's modularscale.com.
66
+ summary: Sassy Modular Scale calculates the incremental values of the modular scale
67
+ in proportion to a set size and ratio. Inspired by and adapted from Tim Brown's
68
+ modularscale.com.
73
69
  test_files: []
74
-