govuk_frontend_toolkit 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ # 4.4.0
2
+
3
+ - Add helpers partial for functions
4
+ - Add px to em function and documentation
5
+
1
6
  # 4.3.0
2
7
 
3
8
  - Allow javascript error tracking to be filtered to avoid noise from plugins
@@ -1 +1 @@
1
- 4.3.0
1
+ 4.4.0
@@ -0,0 +1,62 @@
1
+ ## Functions
2
+
3
+ * [`_helpers.scss`](#helpers)
4
+
5
+ ### <a id="helpers"></a>Helpers
6
+
7
+ The pixel-to-em or `pem` function returns an em value.
8
+
9
+ It sets a Sass variable, $base-font-size, to 16.
10
+
11
+ A value in em is defined as em = target/context.
12
+
13
+ #### Usage:
14
+
15
+ Here the default context is 16 ($base-font-size),
16
+ so there is no need to use a second argument.
17
+
18
+ ```
19
+
20
+ .govuk-title {
21
+ margin-top: pem(30);
22
+ }
23
+
24
+ Compiled css:
25
+
26
+ .govuk-title {
27
+ margin-top: 1.875em;
28
+ }
29
+
30
+ ```
31
+
32
+ The first argument will also accept pixel units.
33
+
34
+ ```
35
+ .govuk-title {
36
+ margin-top: pem(19px);
37
+ }
38
+
39
+ Compiled css:
40
+
41
+ .govuk-title {
42
+ margin-top: 1.1875em;
43
+ }
44
+
45
+ ```
46
+
47
+ If the context changes, use the second argument.
48
+
49
+ ```
50
+ .govuk-title {
51
+ font-size: 48px;
52
+ }
53
+
54
+ .govuk-title-child {
55
+ margin-top: pem(15, 48);
56
+ }
57
+
58
+ Compiled css:
59
+
60
+ .govuk-title-child {
61
+ margin-top: 0.3125em;
62
+ }
@@ -100,12 +100,12 @@ $site-width: 960px;
100
100
  }
101
101
 
102
102
 
103
- // OLD depricated grid mixins
103
+ // OLD deprecated grid mixins
104
104
  // You should migrate to the mixins above in the future
105
105
 
106
106
  // Outer block sets a max width
107
107
  @mixin outer-block {
108
- @warn "The @mixin outer-block is depricated and should be updated to new grid helpers";
108
+ @warn "The @mixin outer-block is deprecated and should be updated to use new grid helpers";
109
109
  margin: 0 auto;
110
110
  width: auto;
111
111
  max-width: 960 + $gutter*2;
@@ -118,7 +118,7 @@ $site-width: 960px;
118
118
  // Inner block sets either margin or padding
119
119
  // to align content with header and footer
120
120
  @mixin inner-block($margin-or-padding: padding) {
121
- @warn "The @mixin inner-block is depricated and should be updated to use new grid helpers";
121
+ @warn "The @mixin inner-block is deprecated and should be updated to use new grid helpers";
122
122
  #{$margin-or-padding}-left: $gutter-half;
123
123
  #{$margin-or-padding}-right: $gutter-half;
124
124
  @include media(tablet) {
@@ -0,0 +1,16 @@
1
+ // Base font size in pixels
2
+ $base-font-size: 16;
3
+
4
+ // Convert pixels to em
5
+ @function pem($px, $base: $base-font-size) {
6
+
7
+ @if (unitless($px)) {
8
+ $px: $px * 1px;
9
+ }
10
+
11
+ @if (unitless($base)) {
12
+ $base: $base * 1px;
13
+ }
14
+
15
+ @return $px / $base * 1em;
16
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_frontend_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-04 00:00:00.000000000 Z
12
+ date: 2015-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -105,6 +105,7 @@ files:
105
105
  - app/assets/README.md
106
106
  - app/assets/VERSION.txt
107
107
  - app/assets/docs/analytics.md
108
+ - app/assets/docs/functions.md
108
109
  - app/assets/docs/javascript.md
109
110
  - app/assets/docs/mixins.md
110
111
  - app/assets/images/accordian-arrow-2x.png
@@ -268,6 +269,7 @@ files:
268
269
  - app/assets/stylesheets/_device-pixels.scss
269
270
  - app/assets/stylesheets/_font_stack.scss
270
271
  - app/assets/stylesheets/_grid_layout.scss
272
+ - app/assets/stylesheets/_helpers.scss
271
273
  - app/assets/stylesheets/_measurements.scss
272
274
  - app/assets/stylesheets/_shims.scss
273
275
  - app/assets/stylesheets/_typography.scss
@@ -291,7 +293,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
291
293
  version: '0'
292
294
  segments:
293
295
  - 0
294
- hash: 1001305014484830517
296
+ hash: -607685694881966234
295
297
  required_rubygems_version: !ruby/object:Gem::Requirement
296
298
  none: false
297
299
  requirements:
@@ -300,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
302
  version: '0'
301
303
  segments:
302
304
  - 0
303
- hash: 1001305014484830517
305
+ hash: -607685694881966234
304
306
  requirements: []
305
307
  rubyforge_project:
306
308
  rubygems_version: 1.8.23