Skip to content

Commit be820f1

Browse files
authored
Merge pull request #2 from daliborgogic/publish
feat: default font options
2 parents c7f4f34 + 0aa331b commit be820f1

File tree

6 files changed

+43
-13
lines changed

6 files changed

+43
-13
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
<a name="1.1.0"></a>
6+
# [1.1.0](https://github.com/daliborgogic/font-loading/compare/v1.0.3...v1.1.0) (2018-09-14)
7+
8+
9+
### Features
10+
11+
* default font options ([afdcea4](https://github.com/daliborgogic/font-loading/commit/afdcea4))
12+
13+
14+
15+
<a name="1.0.3"></a>
16+
## [1.0.3](https://github.com/daliborgogic/font-loading/compare/v1.0.2...v1.0.3) (2018-09-14)
17+
18+
19+
520
<a name="1.0.2"></a>
621
## [1.0.2](https://github.com/daliborgogic/font-loading/compare/v1.0.1...v1.0.2) (2018-09-14)
722

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
Note: Font Loading Module Level 3 is still [under development in some browsers](http://caniuse.com/#feat=font-loading).
77

8-
Proper caching is a must.
9-
108
## Setup
119

1210
- Add ```font-loading``` as dependency
@@ -31,19 +29,25 @@ Type: ```String```
3129

3230
Default: ```-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif```
3331

34-
Font Family
35-
3632
### fontName
3733

3834
Type: ```String```
3935

40-
Font name
41-
4236
### fontPath
4337

4438
Type: ```String```
4539

46-
Font path
40+
### fontOptions.style
41+
42+
Type: ```String```
43+
44+
Default: ```normal```
45+
46+
### fontOptions.weight
47+
48+
Type: ```String```
49+
50+
Default: ```400```
4751

4852
## License
4953

lib/module.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ module.exports = function fontLoading (moduleOptions) {
55

66
options.fontFamily = options.fontFamily || '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
77
options.fontName = options.fontName || 'Default'
8-
options.fontPath = options.fontPath || null
8+
options.fontPath = options.fontPath || undefined
9+
10+
options.fontOptions = options.fontOptions || {
11+
style: 'normal',
12+
weight: '400'
13+
}
914

1015
this.addPlugin({
1116
src: resolve(__dirname, './templates/plugin.js'),

lib/templates/plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { resolve } from 'path'
33
export default async () => {
44
const fontPath = '<%= options.fontPath %>'
55
const parent = document.getElementById('__nuxt')
6+
67
parent.style.fontFamily = '<%= options.fontFamily %>'
78

89
if (fontPath) {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "font-loading",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"description": "Nuxt.js module for Font Loading Module Level 3 used for dynamically loading font resources.",
55
"main": "lib/module.js",
66
"directories": {
@@ -18,9 +18,14 @@
1818
"type": "git",
1919
"url": "git+https://github.com/daliborgogic/font-loading.git"
2020
},
21-
"keywords": [],
22-
"author": "",
23-
"license": "ISC",
21+
"keywords": [
22+
"nuxt",
23+
"module",
24+
"font",
25+
"loading"
26+
],
27+
"author": "Dalibor Gogic <[email protected]>",
28+
"license": "MIT",
2429
"bugs": {
2530
"url": "https://github.com/daliborgogic/font-loading/issues"
2631
},

0 commit comments

Comments
 (0)