grids 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,5 @@
1
1
  window.grids = new Object unless window.grids?
2
2
 
3
- class grids.Scalable
4
- constructor: (@sampleFontSize, @sampleAtomWidth, @sampleAtomHeight, @modulesXCount, @modulesYCount) ->
5
- @ratio = (@modulesYCount * @sampleAtomHeight) / (@modulesXCount * @sampleAtomWidth)
6
- @heightToFontSize = (@modulesYCount * @sampleAtomHeight) / @sampleFontSize
7
- $(window).resize @newFontSize
8
- @newFontSize()
9
-
10
- newFontSize: =>
11
- min = Math.min($(window).innerHeight(), $(window).innerWidth() * @ratio)
12
- fontSize = min / @heightToFontSize
13
- $('body').css(fontSize: "#{fontSize}px")
14
-
15
-
16
3
  # new grids.ToWidthFitter(16 / 1024)
17
4
  class grids.ToWidthFitter
18
5
  constructor: (@sampleFontToSampleWidth) ->
@@ -9,15 +9,21 @@ module Grids
9
9
  end
10
10
 
11
11
  class Importer < Sass::Importers::Filesystem
12
- EXT_REGEX = /\.grid$/
13
-
14
12
  private
15
13
 
16
14
  def _find(dir, name, options)
17
- return unless name =~ EXT_REGEX
15
+ return unless name =~ extension_regex
18
16
  Sass::Engine.new(generate_grid(name, options), options)
19
17
  end
20
18
 
19
+ def template_path
20
+ File.join(File.expand_path('../', __FILE__), 'grid.scss.erb')
21
+ end
22
+
23
+ def extension_regex
24
+ /\.grid$/
25
+ end
26
+
21
27
  def grid_name(filename)
22
28
  filename.split('/').last.split('.').first
23
29
  end
@@ -28,10 +34,7 @@ module Grids
28
34
  grid_settings[:context] = import_settings_template(name)
29
35
 
30
36
  binding = Binding.new(grid_settings)
31
-
32
- grid_template_path = File.join(File.expand_path('../', __FILE__), 'grid.scss.erb')
33
- grid_template = ERB.new(File.read(grid_template_path))
34
-
37
+ grid_template = ERB.new(File.read(template_path))
35
38
  grid_template.result(binding.get_binding)
36
39
  end
37
40
 
@@ -44,7 +47,7 @@ module Grids
44
47
  end
45
48
 
46
49
  def import_settings_template(filename)
47
- settings_file_name = filename.gsub(EXT_REGEX, '')
50
+ settings_file_name = filename.gsub(extension_regex, '')
48
51
  import_template = "@import '#{settings_file_name}';"
49
52
  end
50
53
  end
data/lib/grids/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Grids
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grids
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: