Skip to content

Commit

Permalink
Merge pull request #140 from gseidel/fix-html-option
Browse files Browse the repository at this point in the history
Generate html file
  • Loading branch information
jeerbl authored Jul 2, 2021
2 parents f6d42aa + fd299a5 commit 2d7fd3a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,25 @@ module.exports = function (content) {
emitCodepoints.emitFiles(this, emitCodepointsOptions, generatorOptions, options);
}

if (generatorOptions.html) {
var htmlDest = generatorOptions.htmlDest ? generatorOptions.htmlDest : generatorOptions.fontName + '.html';
htmlDest = generatorOptions.dest.concat(htmlDest);
htmlDest = loaderUtils.interpolateName(this,
htmlDest,
{
context: this.rootContext || this.options.context || this.context
}
);

var relativeUrls = {};
for (var key in urls) {
relativeUrls[key] = path.relative(url.resolve(publicPath, path.dirname(htmlDest.replace(/\\/g, '/'))), urls[key]);
}

var htmlContent = res.generateHtml(relativeUrls);
this.emitFile(htmlDest, htmlContent);
}

cb(null, res.generateCss(urls));
});
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webfonts-loader",
"version": "7.2.0",
"description": "A WebPack loader to automaticaly generate font files and CSS to make your own icon font",
"description": "A WebPack loader to automatically generate font files and CSS to make your own icon font",
"repository": "jeerbl/webfonts-loader",
"main": "index.js",
"scripts": {
Expand All @@ -25,7 +25,7 @@
},
"license": "MIT",
"dependencies": {
"@vusion/webfonts-generator": "^0.7.0",
"@vusion/webfonts-generator": "^0.7.2",
"glob": "^7.1.6",
"loader-utils": "^2.0.0"
},
Expand Down

0 comments on commit 2d7fd3a

Please sign in to comment.