Skip to content

Commit

Permalink
[2.3.0] add support for subsets of the google fonts unicode ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdee committed Nov 11, 2019
1 parent da72cda commit ed91ad9
Show file tree
Hide file tree
Showing 8 changed files with 920 additions and 6,179 deletions.
58 changes: 43 additions & 15 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,55 @@
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"extends": "eslint:recommended",
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": "error",
"indent": [
"quotes": [2, "single"],
"indent": [2, 4, { "SwitchCase": 1 }],
"no-console": 1,
"key-spacing":[
"error",
4
{
"beforeColon": false,
"afterColon": true,
"mode": "strict"
}
],
"linebreak-style": [
"error",
"unix"
"no-debugger": 1,
"no-var": 1,
"semi": [1, "always"],
"no-trailing-spaces": 1,
"eol-last": 0,
"no-underscore-dangle": 0,
"no-alert": 0,
"no-lone-blocks": 0,
"jsx-quotes": 1,
"no-duplicate-case": 0,
"no-unused-vars": [
1,
{ "vars": "all", "args": "after-used", "ignoreRestSiblings": true }
],
"quotes": [
"error",
"single"
"no-empty": [2, { "allowEmptyCatch": true }],
"array-element-newline": [
"warn",
"consistent"
],
"semi": [
"error",
"always"
"array-bracket-spacing": [
"warn",
"always",
{
"singleValue": true,
"objectsInArrays": false,
"arraysInArrays": false
}
],
"object-property-newline": [
"warn",
{
"allowAllPropertiesOnSameLine": false
}
]
}
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2.3.0 (2019-11-11)

Added: Support of Google fonts unicode-range subsets
Fixed: refactoring the plugin script
Updated: google-fonts-complete dependency
Updated: dev dependecies
Updated: package.json
Updated: eslint rules


## 2.2.2 (2019-06-13)

Updated: google-fonts-complete dependency
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ yarn add postcss-font-magician --dev

Use [Font Magician] in your script:
```js
const fs = require('fs');
const postcss = require('postcss');
const pfm = require('postcss-font-magician');
postcss([
pfm({ /* options */ })
Expand Down Expand Up @@ -207,14 +209,14 @@ The plugin will download the font only selected weights, styles and formats.

### unicode-range

Need to support [unicode-range](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range)? You can use it as a second element in an option array.
Need to support [unicode-range](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range)? You can use both the names of the subsets of Google fonts (e.g. 'latin-ext' or 'cyrillic') and specific unicode ranges values. You can use it as a second element in an option array.

```js
require('postcss-font-magician')({
variants: {
'Open Sans': {
'300': ['woff, eot, woff2', 'U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF'],
'400 italic': ['woff2']
'300': ['woff2', 'cyrillic-ext, greek'],
'400 italic': ['woff2', 'U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF']
}
}
});
Expand Down
Loading

0 comments on commit ed91ad9

Please sign in to comment.