Skip to content

Commit

Permalink
Merge pull request #72 from JesseFarebro/extra-options
Browse files Browse the repository at this point in the history
Add subsetPerPage & format options
  • Loading branch information
Munter committed Jan 3, 2020
2 parents fe484d6 + 1fe21be commit cff1fc4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Options:
--font-display Injects a font-display value into the @font-face CSS. Valid
values: auto, block, swap, fallback, optional
[string] [choices: "auto", "block", "swap", "fallback", "optional"] [default: "swap"]
--formats Font formats to use when subsetting.
[array] [choices: "woff2", "woff", "truetype"] [default: ["woff2","woff"]]
--subset-per-page Create a unique subset for each page.
[boolean] [default: false]
--recursive, -r Crawl all HTML-pages linked with relative and root relative
links. This stays inside your domain
[boolean] [default: false]
Expand Down
13 changes: 13 additions & 0 deletions lib/parseCommandLineOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ module.exports = function parseCommandLineOptions(argv) {
default: 'swap',
choices: ['auto', 'block', 'swap', 'fallback', 'optional']
})
.options('formats', {
describe:
'Font formats to use when subsetting.',
type: 'array',
default: ['woff2', 'woff'],
choices: ['woff2', 'woff', 'truetype']
})
.options('subset-per-page', {
describe:
'Create a unique subset for each page.',
type: 'boolean',
default: false
})
.options('recursive', {
alias: 'r',
describe:
Expand Down
4 changes: 4 additions & 0 deletions lib/subfont.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = async function subfont(
inlineFonts = false,
inlineCss = false,
fontDisplay = 'swap',
formats = ['woff2', 'woff'],
subsetPerPage = false,
inPlace = false,
inputFiles = [],
recursive = false,
Expand Down Expand Up @@ -147,6 +149,8 @@ module.exports = async function subfont(
inlineFonts,
inlineCss,
fontDisplay,
subsetPerPage,
formats,
omitFallbacks: !fallbacks,
dynamic,
console
Expand Down

0 comments on commit cff1fc4

Please sign in to comment.