{"_id":"vusion-webfonts-generator","_rev":"1-b627152e232b304ccc57b50d41947cd5","name":"vusion-webfonts-generator","description":"Generator of webfonts from svg icons","dist-tags":{"latest":"0.4.1"},"versions":{"0.4.1":{"name":"vusion-webfonts-generator","version":"0.4.1","description":"Generator of webfonts from svg icons","main":"src/index.js","directories":{"test":"tests"},"scripts":{"test":"mocha tests"},"repository":{"type":"git","url":"git+https://github.com/vusion/webfonts-generator.git"},"keywords":["font","webfont","svg","ttf","woff","woff2"],"author":{"name":"moujintao","email":"moujintaotest@163.com"},"license":"Unlicense","bugs":{"url":"https://github.com/vusion/webfonts-generator/issues"},"dependencies":{"handlebars":"^4.0.5","mkdirp":"^0.5.0","q":"^1.1.2","svg2ttf":"^4.0.0","svgicons2svgfont":"^5.0.0","ttf2eot":"^2.0.0","ttf2woff":"^2.0.1","ttf2woff2":"^2.0.3","underscore":"^1.7.0","url-join":"^1.1.0"},"devDependencies":{"file-type":"^3.9.0","mocha":"^3.1.2","node-sass":"^3.4.2","read-chunk":"^2.0.0"},"gitHead":"5f5f5de2579f73b9de7567a10cd0d7af7ace5b69","homepage":"https://github.com/vusion/webfonts-generator#readme","_id":"vusion-webfonts-generator@0.4.1","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"alfredmou","email":"moujintaotest@163.com"},"dist":{"integrity":"sha512-ij+PKR4tL/e7cpY/3rX9DPL61YtOT2j73OKoHyLj5xpR/JRupYs6q3jCKWA4Wim9hL07Aab9jZ/MuOJKPhCyzA==","shasum":"d89a3701e8d5f5612d3afb9816cd215b0704d742","tarball":"https://registry.npmjs.org/vusion-webfonts-generator/-/vusion-webfonts-generator-0.4.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAXsIsZ67YfdAPpcfPtGdcJrtbbutmV/9Vcl1+Elwm7jAiA4q+uHJ9YVO35/XRC4LtbqP/qp8UTP3FIsrU920r65GQ=="}]},"maintainers":[{"name":"alfredmou","email":"moujintaotest@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vusion-webfonts-generator-0.4.1.tgz_1515413626527_0.12187575316056609"}}},"readme":"# webfonts-generator\n\n\n[![Build Status](https://travis-ci.org/sunflowerdeath/webfonts-generator.svg?branch=master)](https://travis-ci.org/sunflowerdeath/webfonts-generator)\n\nGenerator of webfonts from SVG icons.\n\nFeatures:\n\n* Supported font formats: WOFF2, WOFF, EOT, TTF and SVG.\n* Supported browsers: IE8+.\n* Generates CSS files and HTML preview, allows to use custom templates.\n\n## Install\n\n```\nnpm install --save-dev webfonts-generator\n```\n\n## Usage\n\n```js\nconst webfontsGenerator = require('webfonts-generator');\n\nwebfontsGenerator({\n  files: [\n    'src/dropdown.svg',\n    'src/close.svg',\n  ],\n  dest: 'dest/',\n}, function(error) {\n  if (error) {\n    console.log('Fail!', error);\n  } else {\n    console.log('Done!');\n  }\n})\n```\n\n## webfontsGenerator(options, done)\n\n### options\n\nType: `object`\n\nObject with options. See the list of options.\n\n### done\n\nType: `function(error, result)`\n\n## List of options\n\n### files\n\n*required*\n\nType: `array.<string>|array.<readStream> `\n\nList of SVG files.\n\n### dest\n\n*required*\n\nType: `string`\n\nDirectory for generated font files.\n\n### fontName\n\nType: `string`\n<br>\nDefault: `'iconfont'`\n\nName of font and base name of font files.\n\n### css\n\nType: `boolean`\n<br>\nDefault: `true`\n\nWhether to generate CSS file.\n\n### cssDest\n\nType: `string`\n<br>\nDefault: `path.join(options.dest, options.fontName + '.css')`\n\nPath for generated CSS file.\n\n### cssTemplate\n\nType: `string`\n<br>\nDefault: path of default CSS template\n\nPath of custom CSS template.\nGenerator uses handlebars templates.\n\nTemplate receives options from `options.templateOptions` along with the following options:\n\n* fontName\n* src `string` &ndash; Value of the `src` property for `@font-face`.\n* codepoints `object` &ndash; Codepoints of icons in hex format.\n\nPaths of default templates are stored in the `webfontsGenerator.templates` object.\n\n* `webfontsGenerator.templates.css` &ndash; Default CSS template path.\n\t<br>\n\tIt generates classes with names based on values from `options.templateOptions`.\n\n* `webfontsGenerator.templates.scss` &ndash; Default SCSS template path.\n\t<br>\n\tIt generates mixin `webfont-icon` to add icon styles.\n\t<br>\n\tIt is safe to use multiple generated files with mixins together.\n\t<br>\n\tExample of use:\n\n\t```\n\t@import 'iconfont';\n\t.icon { @include webfont-icon('icon'); }\n\t```\n\n### cssFontsPath\n\nType: `string`\n<br>\nDefault: `options.destCss`\n\nFonts path used in CSS file.\n\n### html\n\nType: `boolean`\n<br>\nDefault: `false`\n\nWhether to generate HTML preview.\n\n### htmlDest\n\nType: `string`\n<br>\nDefault: `path.join(options.dest, options.fontName + '.html')`\n\nPath for generated HTML file.\n\n### htmlTemplate\n\nType: `string`\n<br>\nDefault: `templates/html.hbs`\n\nHTML template path.\nGenerator uses handlebars templates.\n\nTemplate receives options from `options.templateOptions` along with the following options:\n\n* fontName\n* styles `string` &ndash; Styles generated with default CSS template.\n\t(`cssFontsPath` is chaged to relative path from `htmlDest` to `dest`)\n* names `array.<string>` &ndash; Names of icons.\n\n### templateOptions\n\nType: `object`\n\nAdditional options for CSS & HTML templates, that extends default options.\n\nDefault options are:\n```js\n{\n\tclassPrefix: 'icon-',\n\tbaseSelector: '.icon'\n}\n```\n\n### types\n\nType: `array<string>`\n<br>\nDefault: `['woff2', 'woff', 'eot']`\n\nFont file types to generate.\nPossible values: `svg, ttf, woff, woff2, eot`.\n\n### order\n\nType: `array<string>`\n<br>\nDefault: `['eot', 'woff2', 'woff', 'ttf', 'svg']`\n\nOrder of `src` values in `font-face` in CSS file.\n\n### rename\n\nType: `function(string) -> string`\n<br>\nDefault: basename of file\n\nFunction that takes path of file and return name of icon.\n\n### startCodepoint\n\nType: `number`\n<br>\nDefault: `0xF101`\n\nStarting codepoint. Defaults to beginning of unicode private area.\n\n### codepoints\n\nType: `object`\n\nSpecific codepoints for certain icons.\nIcons without codepoints will have codepoints incremented from `startCodepoint` skipping duplicates.\n\n### fontName, normalize, fontHeight, round, descent\n\nOptions that are passed directly to\n[svgicons2svgfont](https://github.com/nfroidure/svgicons2svgfont).\n\n### formatOptions\n\nType: `object`\n\nSpecific per format arbitrary options to pass to the generator\n\nformat and matching generator:\n- `svg` - [svgicons2svgfont](https://github.com/nfroidure/svgicons2svgfont).\n- `ttf` - [svg2ttf](https://github.com/fontello/svg2ttf).\n- `woff2` - [ttf2woff2](https://github.com/nfroidure/ttf2woff2).\n- `woff` - [ttf2woff](https://github.com/fontello/ttf2woff).\n- `eot` - [ttf2eot](https://github.com/fontello/ttf2eot).\n\n```js\nwebfontsGenerator({\n  // options\n  formatOptions: {\n  \t// options to pass specifically to the ttf generator\n  \tttf: {\n  \t\tts: 1451512800000\n  \t}\n  }\n}, function(error, result) {})\n```\n\n### writeFiles\n\nType: `boolean`\n<br>\nDefault: `true`\n\nIt is possible to not create files and get generated fonts in object\n to write them to files later.\n<br>\nAlso results object will have function `generateCss([urls])`\nwhere `urls` is an object with future fonts urls.\n\n```js\nwebfontsGenerator({\n  // options\n  writeFiles: false\n}, function(error, result) {\n  // result.eot, result.ttf, etc - generated fonts\n  // result.generateCss(urls) - function to generate css\n})\n```\n\n## License\n\nPublic domain, see the `LICENCE` file.\n","maintainers":[{"name":"alfredmou","email":"moujintaotest@163.com"}],"time":{"modified":"2022-05-23T23:13:21.994Z","created":"2018-01-08T12:13:46.638Z","0.4.1":"2018-01-08T12:13:46.638Z"},"homepage":"https://github.com/vusion/webfonts-generator#readme","keywords":["font","webfont","svg","ttf","woff","woff2"],"repository":{"type":"git","url":"git+https://github.com/vusion/webfonts-generator.git"},"author":{"name":"moujintao","email":"moujintaotest@163.com"},"bugs":{"url":"https://github.com/vusion/webfonts-generator/issues"},"license":"Unlicense","readmeFilename":"README.md"}