Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Adds generateHtml method to the results object #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ Default: `true`
It is possible to not create files and get generated fonts in object
to write them to files later.
<br>
Also results object will have function `generateCss([urls])`
Also results object will have `generateCss([urls])` and `generateHtml()` functions
where `urls` is an object with future fonts urls.

```js
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ var webfont = function(options, done) {
result.generateCss = function(urls) {
return renderCss(options, urls)
}
result.generateHtml = function() {
return renderHtml(options)
}
done(null, result)
})
.catch(function(err) { done(err) })
Expand Down
3 changes: 3 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ describe('webfont', function() {
assert.equal(typeof result.generateCss, 'function')
var css = result.generateCss()
assert.equal(typeof css, 'string')
assert.equal(typeof result.generateHtml, 'function')
var html = result.generateHtml()
assert.equal(html, 'string')
})
})

Expand Down