svgicons2svgfont
Advanced tools
Comparing version 3.0.3 to 3.0.4
{ | ||
"name": "svgicons2svgfont", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "Read a set of SVG icons and ouput a SVG font", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/nfroidure/svgicons2svgfont", |
# svgicons2svgfont | ||
> svgicons2svgfont is a simple tool to merge multiple icons to an SVG font. | ||
[![NPM version](https://badge.fury.io/js/svgicons2svgfont.png)](https://npmjs.org/package/svgicons2svgfont) [![Build status](https://secure.travis-ci.org/nfroidure/svgicons2svgfont.png)](https://travis-ci.org/nfroidure/svgicons2svgfont) [![Dependency Status](https://david-dm.org/nfroidure/svgicons2svgfont.png)](https://david-dm.org/nfroidure/svgicons2svgfont) [![devDependency Status](https://david-dm.org/nfroidure/svgicons2svgfont/dev-status.png)](https://david-dm.org/nfroidure/svgicons2svgfont#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/nfroidure/svgicons2svgfont/badge.png?branch=master)](https://coveralls.io/r/nfroidure/svgicons2svgfont?branch=master) [![Code Climate](https://codeclimate.com/github/nfroidure/svgicons2svgfont.png)](https://codeclimate.com/github/nfroidure/svgicons2svgfont) | ||
[![NPM version](https://badge.fury.io/js/svgicons2svgfont.svg)](https://npmjs.org/package/svgicons2svgfont) [![Build status](https://secure.travis-ci.org/nfroidure/svgicons2svgfont.png)](https://travis-ci.org/nfroidure/svgicons2svgfont) [![Dependency Status](https://david-dm.org/nfroidure/svgicons2svgfont.svg)](https://david-dm.org/nfroidure/svgicons2svgfont) [![devDependency Status](https://david-dm.org/nfroidure/svgicons2svgfont/dev-status.svg)](https://david-dm.org/nfroidure/svgicons2svgfont#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/nfroidure/svgicons2svgfont/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/svgicons2svgfont?branch=master) [![Code Climate](https://codeclimate.com/github/nfroidure/svgicons2svgfont.svg)](https://codeclimate.com/github/nfroidure/svgicons2svgfont) | ||
@@ -6,0 +6,0 @@ 'rect', 'line', 'circle', 'ellipsis', 'polyline' and 'polygon' shapes will be |
@@ -18,2 +18,3 @@ var fs = require('fs'); | ||
var filesInfos; | ||
var gotFilesInfos = false; | ||
@@ -54,2 +55,5 @@ // Ensure new were used | ||
}); | ||
// Mark directory as processed | ||
gotFilesInfos = true; | ||
// Start processing | ||
_pushSVGIcons(); | ||
@@ -95,4 +99,7 @@ } | ||
); | ||
return; | ||
} | ||
if(gotFilesInfos) { | ||
_pushSVGIcons(); | ||
} | ||
}; | ||
@@ -99,0 +106,0 @@ |
@@ -209,3 +209,3 @@ /* | ||
this._readableState.objectMode = false; | ||
var i = 0; | ||
// Parse input | ||
@@ -388,4 +388,4 @@ this._transform = function _svgIcons2SVGFontStreamTransform( | ||
} catch(err) { | ||
_this.emit('error', 'Got an error parsing the glyph "' + | ||
glyph.name + '" path data: ' + cD + '.'); | ||
_this.emit('error', new Error('Got an error parsing the glyph' + | ||
' "' + glyph.name + '" path data: ' + cD + '.')); | ||
} | ||
@@ -392,0 +392,0 @@ }); |
@@ -28,2 +28,30 @@ var svgicons2svgfont = require(__dirname + '/../src/index.js'); | ||
it("should work for more than 32 SVG icons", function(done) { | ||
(require('child_process').exec)( | ||
'node ' + __dirname + '/../bin/svgicons2svgfont.js' + | ||
' -o ' + __dirname + '/results/lotoficons-cli.svg' + | ||
' -s 0xE001' + | ||
' ' + __dirname + '/fixtures/cleanicons/*.svg ' + | ||
' ' + __dirname + '/fixtures/hiddenpathesicons/*.svg ' + | ||
' ' + __dirname + '/fixtures/multipathicons/kikoolol.svg ' + | ||
' ' + __dirname + '/fixtures/originalicons/*.svg ' + | ||
' ' + __dirname + '/fixtures/realicons/*.svg ' + | ||
' ' + __dirname + '/fixtures/roundedcorners/*.svg ' + | ||
' ' + __dirname + '/fixtures/shapeicons/*.svg ' + | ||
' ' + __dirname + '/fixtures/tocentericons/*.svg ', | ||
function(err) { | ||
if(err) { | ||
throw err; | ||
} | ||
assert.equal( | ||
fs.readFileSync(__dirname + '/results/lotoficons-cli.svg', | ||
{encoding: 'utf8'}), | ||
fs.readFileSync(__dirname + '/expected/lotoficons-cli.svg', | ||
{encoding: 'utf8'}) | ||
); | ||
done(); | ||
} | ||
); | ||
}); | ||
describe("with nested icons", function(done) { | ||
@@ -30,0 +58,0 @@ |
@@ -10,3 +10,3 @@ var assert = require('assert'); | ||
// Helpers | ||
function generateFontToFile(options, done, fileSuffix, startUnicode) { | ||
function generateFontToFile(options, done, fileSuffix, startUnicode, files) { | ||
var dest = __dirname + '/results/' + options.fontName + | ||
@@ -28,3 +28,3 @@ (fileSuffix || '') + '.svg'; | ||
SVGIconsDirStream(__dirname + '/fixtures/' + options.fontName, { | ||
SVGIconsDirStream(files || __dirname + '/fixtures/' + options.fontName, { | ||
startUnicode: startUnicode || 0xE001 | ||
@@ -35,3 +35,3 @@ }) | ||
function generateFontToMemory(options, done, fileSuffix, startUnicode) { | ||
function generateFontToMemory(options, done, files, startUnicode) { | ||
var content = ''; | ||
@@ -55,3 +55,3 @@ var decoder = new StringDecoder('utf8'); | ||
SVGIconsDirStream(__dirname + '/fixtures/' + options.fontName, { | ||
SVGIconsDirStream(files || __dirname + '/fixtures/' + options.fontName, { | ||
startUnicode: startUnicode || 0xE001 | ||
@@ -181,2 +181,43 @@ }) | ||
it("should work with a lot of icons", function(done) { | ||
generateFontToFile({ | ||
fontName: 'lotoficons' | ||
}, done, '', 0, [ | ||
'tests/fixtures/cleanicons/account.svg', | ||
'tests/fixtures/cleanicons/arrow-down.svg', | ||
'tests/fixtures/cleanicons/arrow-left.svg', | ||
'tests/fixtures/cleanicons/arrow-right.svg', | ||
'tests/fixtures/cleanicons/arrow-up.svg', | ||
'tests/fixtures/cleanicons/basket.svg', | ||
'tests/fixtures/cleanicons/close.svg', | ||
'tests/fixtures/cleanicons/minus.svg', | ||
'tests/fixtures/cleanicons/plus.svg', | ||
'tests/fixtures/cleanicons/search.svg', | ||
'tests/fixtures/hiddenpathesicons/sound--off.svg', | ||
'tests/fixtures/hiddenpathesicons/sound--on.svg', | ||
'tests/fixtures/multipathicons/kikoolol.svg', | ||
'tests/fixtures/originalicons/mute.svg', | ||
'tests/fixtures/originalicons/sound.svg', | ||
'tests/fixtures/originalicons/speaker.svg', | ||
'tests/fixtures/realicons/diegoliv.svg', | ||
'tests/fixtures/realicons/hannesjohansson.svg', | ||
'tests/fixtures/realicons/roelvanhitum.svg', | ||
'tests/fixtures/realicons/safety-icon.svg', | ||
'tests/fixtures/realicons/sb-icon.svg', | ||
'tests/fixtures/realicons/settings-icon.svg', | ||
'tests/fixtures/realicons/track-icon.svg', | ||
'tests/fixtures/realicons/web-icon.svg', | ||
'tests/fixtures/roundedcorners/roundedrect.svg', | ||
'tests/fixtures/shapeicons/circle.svg', | ||
'tests/fixtures/shapeicons/ellipse.svg', | ||
'tests/fixtures/shapeicons/lines.svg', | ||
'tests/fixtures/shapeicons/polygon.svg', | ||
'tests/fixtures/shapeicons/polyline.svg', | ||
'tests/fixtures/shapeicons/rect.svg', | ||
'tests/fixtures/tocentericons/bottomleft.svg', | ||
'tests/fixtures/tocentericons/center.svg', | ||
'tests/fixtures/tocentericons/topright.svg' | ||
]); | ||
}); | ||
}); | ||
@@ -183,0 +224,0 @@ |
214883
106
1329
3