boxmodel-rails 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1ab360ba5324a82f8a4f634d63d8ccb536f4a36
4
- data.tar.gz: 0c7ce044be7f2d73457276f55378d50f38a70719
3
+ metadata.gz: 4da5520d2a2541cb5cca8567f0587cbffa94f01a
4
+ data.tar.gz: 989395fab6c1c14b273a3cc38f4aaa4f01989ee9
5
5
  SHA512:
6
- metadata.gz: dc6d3dff385b731f3dfec7d999897dab4e00e790bea820ce50218fda48133f6c3318489e930235e47707e07277777a522ba75c4c579c14d06845bbad4ecd7f8c
7
- data.tar.gz: bc0bdfb3a181feffd501477df90512e85a54b86dd7369bcf9cf2ee55bd1bc789f097eb7b1133ce67e090a77a075a0fa0c9c64f4f1e8ac81caeac9b50b1500626
6
+ metadata.gz: 6fec2e594b9ef8f2c59d496ccc10d9fd0c250aeb86eb00262b38ef1fdc76ba20d948c0ccbd06d7e88038b975387eec98687599a5de975c293b8854c9a63322ae
7
+ data.tar.gz: f8c168648573871477b3eb91698213f27c7568a48469a3c6c99bd960445169efb847626126044c36ad1f9d5a7b2dcfb765c91506cab2c9eddc1c14e19b9dfc85
data/README.md CHANGED
@@ -30,11 +30,20 @@ $minValue: -10;
30
30
  $maxValue: 10;
31
31
  @import 'boxmodel';
32
32
  ```
33
+ You can also generate classes only for specific values. To do so, define a list of values like this:
34
+
35
+ ```scss
36
+ $values: -5,1,2,3,10,40;
37
+ @import 'boxmodel';
38
+ ```
39
+ If you set the `$values` to something else than `null`, variables `$step`, `$minValues` and `$maxValue` are not taken into account.
33
40
 
34
41
  Variables:
35
42
 
36
- - `step` - defines the step by which the classes will be generated, e.g. 5 will generate *-5 *-10 etc
37
- - `maxValue` - defines the maximum value that will be generated
43
+ - `step` - defines the step by which the classes will be generated, e.g. 5 will generate *-5 *-10 etc.
44
+ - `minValue` - defines the minimum value that will be generated.
45
+ - `maxValue` - defines the maximum value that will be generated.
46
+ - `values` - defines a list of specific values that will be generated. It's `null` by default.
38
47
 
39
48
  #### Types of classes
40
49
 
@@ -71,8 +80,8 @@ So for example:
71
80
 
72
81
  ## Contributing
73
82
 
74
- 1. Fork it
75
- 2. Create your feature branch (`git checkout -b my-new-feature`)
76
- 3. Commit your changes (`git commit -am 'Add some feature'`)
77
- 4. Push to the branch (`git push origin my-new-feature`)
78
- 5. Create new Pull Request
83
+ 1. Fork it.
84
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
85
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
86
+ 4. Push to the branch (`git push origin my-new-feature`).
87
+ 5. Create new Pull Request.
@@ -1,5 +1,5 @@
1
1
  module Boxmodel
2
2
  module Rails
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -2,11 +2,51 @@
2
2
  // Copyright 2013 KMP group sp. z o.o.
3
3
  // Licensed under MIT License
4
4
 
5
- // Variables
6
- $step: 5 !default
7
- $minValue: 0 !default
8
- $maxValue: 40 !default
5
+ // Mixins
6
+ @mixin classes($val)
7
+ // Four way classes
8
+ .m-#{$val}
9
+ margin: $val * 1px !important
10
+ @if $val >= 0
11
+ .p-#{$val}
12
+ padding: $val * 1px !important
13
+ // One way classes
14
+ .m-t-#{$val}
15
+ margin-top: $val * 1px !important
16
+ .m-r-#{$val}
17
+ margin-right: $val * 1px !important
18
+ .m-b-#{$val}
19
+ margin-bottom: $val * 1px !important
20
+ .m-l-#{$val}
21
+ margin-left: $val * 1px !important
22
+ .m-h-#{$val}
23
+ margin-left: $val * 1px !important
24
+ margin-right: $val * 1px !important
25
+ .m-v-#{$val}
26
+ margin-top: $val * 1px !important
27
+ margin-bottom: $val * 1px !important
28
+ @if $val > 0
29
+ .p-t-#{$val}
30
+ padding-top: $val * 1px !important
31
+ .p-b-#{$val}
32
+ padding-bottom: $val * 1px !important
33
+ .p-r-#{$val}
34
+ padding-right: $val * 1px !important
35
+ .p-l-#{$val}
36
+ padding-left: $val * 1px !important
37
+ .p-h-#{$val}
38
+ padding-left: $val * 1px !important
39
+ padding-right: $val * 1px !important
40
+ .p-v-#{$val}
41
+ padding-top: $val * 1px !important
42
+ padding-bottom: $val * 1px !important
9
43
 
44
+ // Variables
45
+ $step: 5 !default
46
+ $minValue: 0 !default
47
+ $maxValue: 40 !default
48
+ $values: null !default
49
+
10
50
  // Disabling classes
11
51
  .n-m
12
52
  margin: 0 !important
@@ -56,42 +96,13 @@ $maxValue: 40 !default
56
96
  border-bottom: none !important
57
97
  .n-b-l
58
98
  border-left: none !important
99
+
100
+ @if $values == null
101
+ @for $i from $minValue through ceil($maxValue/$step)
102
+ $val: $step * $i
103
+ @mixin classes($val)
104
+ @else
105
+ @each $val in $values
106
+ @mixin classes($val)
59
107
 
60
- @for $i from $minValue through ceil($maxValue/$step)
61
- $val: $step * $i
62
- // Four way classes
63
- .m-#{$val}
64
- margin: $val * 1px !important
65
- @if $val >= 0
66
- .p-#{$val}
67
- padding: $val * 1px !important
68
- // One way classes
69
- .m-t-#{$val}
70
- margin-top: $val * 1px !important
71
- .m-r-#{$val}
72
- margin-right: $val * 1px !important
73
- .m-b-#{$val}
74
- margin-bottom: $val * 1px !important
75
- .m-l-#{$val}
76
- margin-left: $val * 1px !important
77
- .m-h-#{$val}
78
- margin-left: $val * 1px !important
79
- margin-right: $val * 1px !important
80
- .m-v-#{$val}
81
- margin-top: $val * 1px !important
82
- margin-bottom: $val * 1px !important
83
- @if $val >= 0
84
- .p-t-#{$val}
85
- padding-top: $val * 1px !important
86
- .p-b-#{$val}
87
- padding-bottom: $val * 1px !important
88
- .p-r-#{$val}
89
- padding-right: $val * 1px !important
90
- .p-l-#{$val}
91
- padding-left: $val * 1px !important
92
- .p-h-#{$val}
93
- padding-left: $val * 1px !important
94
- padding-right: $val * 1px !important
95
- .p-v-#{$val}
96
- padding-top: $val * 1px !important
97
- padding-bottom: $val * 1px !important
108
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxmodel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Szymon Szeliga
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-15 00:00:00.000000000 Z
12
+ date: 2014-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler