Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

View File

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013 Nicolas Froidure, <http://insertafter.com/>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,112 @@
# gulp-svgicons2svgfont
> Create an SVG font from several SVG icons with [Gulp](http://gulpjs.com/).
[![NPM version](https://badge.fury.io/js/gulp-svgicons2svgfont.svg)](https://npmjs.org/package/gulp-svgicons2svgfont) [![Build status](https://secure.travis-ci.org/nfroidure/gulp-svgicons2svgfont.svg)](https://travis-ci.org/nfroidure/gulp-svgicons2svgfont) [![Dependency Status](https://david-dm.org/nfroidure/gulp-svgicons2svgfont.svg)](https://david-dm.org/nfroidure/gulp-svgicons2svgfont) [![devDependency Status](https://david-dm.org/nfroidure/gulp-svgicons2svgfont/dev-status.svg)](https://david-dm.org/nfroidure/gulp-svgicons2svgfont#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/nfroidure/gulp-svgicons2svgfont/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/gulp-svgicons2svgfont?branch=master) [![Code Climate](https://codeclimate.com/github/nfroidure/gulp-svgicons2svgfont.svg)](https://codeclimate.com/github/nfroidure/gulp-svgicons2svgfont)
You can test this library with the
[frontend generator](http://nfroidure.github.io/svgiconfont/).
## Usage
First, install `gulp-svgicons2svgfont` as a development dependency:
```shell
npm install --save-dev gulp-svgicons2svgfont
```
Then, add it to your `gulpfile.js`:
```javascript
var svgicons2svgfont = require('gulp-svgicons2svgfont');
gulp.task('Iconfont', function(){
gulp.src(['assets/icons/*.svg'])
.pipe(svgicons2svgfont({
fontName: 'myfont'
}))
.on('glyphs', function(glyphs) {
console.log(glyphs);
// Here generate CSS/SCSS for your glyphs ...
})
.pipe(gulp.dest('www/font/'));
});
```
Every icon must be prefixed with it's codepoint. The `appendCodepoints` option
allows to do it automatically. Then, in your own CSS, you just have to use
the corresponding codepoint to display your icon. See this
[sample less mixin](https://github.com/ChtiJS/chtijs.francejs.org/blob/master/documents/less/_icons.less)
for a real world usage.
The plugin stream emits a `codepoints` event letting you do whatever you want
with them.
Please report icons to font issues to the
[svgicons2svgfont](https://github.com/nfroidure/svgicons2svgfont) repository
on wich this plugin depends. Note this Gulp plugin is strictly equivalent to
the above module [CLI interface](https://github.com/nfroidure/svgicons2svgfont#cli-interface).
## API
### svgicons2svgfont(options)
#### options.ignoreExt
Type: `Boolean`
Default value: `false`
Set to true to also convert read icons that doesn't have the .svg extension.
#### options.prependUnicode
Type: `Boolean`
Default value: `false`
Allow to prepend unicode codepoints to icon file names in order to always keep
the same codepoints accross each run.
#### options.fileName
Type: `String`
Default value: options.fontName
Allows to specify a fileName if needed it to be different from the fontName, eg. do not want to have spaces.
#### options.startUnicode
Type: `integer`
Default value: `0xEA01`
Starting codepoint used for the generated glyphs. Defaults to a region within the Unicode private use area which is currently unused. See [this blog post](http://www.filamentgroup.com/lab/bulletproof_icon_fonts.html) for further details and additional suggestions regarding accessibility of icon fonts.
#### options.metadataProvider
Type: `Function`
Default value: [`require('svgicons2svgfont/src/metadata')(options)`](https://github.com/nfroidure/gulp-svgicons2svgfont/blob/master/src/index.js#L47-L50)
Allows to define your own logic to attach codepoints to input files.
#### options.*
The [svgfont2svgicons](https://github.com/nfroidure/svgicons2svgfont#svgicons2svgfontoptions)
options are also available:
* options.fontName (required)
* options.fileName
* options.fontWeight
* options.fontStyle
* options.fixedWidth
* options.centerHorizontally
* options.normalize
* options.fontHeight
* options.round
* options.descent
* options.metadata
* options.log
### Note
You may look after a full Gulp web font workflow, see
[gulp-iconfont](https://github.com/nfroidure/gulp-iconfont)
fot that matter.
## Stats
[![NPM](https://nodei.co/npm/gulp-svgicons2svgfont.png?downloads=true&stars=true)](https://nodei.co/npm/gulp-svgicons2svgfont/)
[![NPM](https://nodei.co/npm-dl/gulp-svgicons2svgfont.png)](https://nodei.co/npm/gulp-svgicons2svgfont/)
## Contributing
Feel free to push your code if you agree with publishing under the MIT license.

View File

@ -0,0 +1,87 @@
{
"_from": "gulp-svgicons2svgfont@^3.0.1",
"_id": "gulp-svgicons2svgfont@3.0.3",
"_inBundle": false,
"_integrity": "sha1-ZQCK/4djOipMZMf6PIxt4NBgNKY=",
"_location": "/gulp-svgicons2svgfont",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "gulp-svgicons2svgfont@^3.0.1",
"name": "gulp-svgicons2svgfont",
"escapedName": "gulp-svgicons2svgfont",
"rawSpec": "^3.0.1",
"saveSpec": null,
"fetchSpec": "^3.0.1"
},
"_requiredBy": [
"/gulp-iconfont"
],
"_resolved": "https://registry.npmjs.org/gulp-svgicons2svgfont/-/gulp-svgicons2svgfont-3.0.3.tgz",
"_shasum": "65008aff87633a2a4c64c7fa3c8c6de0d06034a6",
"_spec": "gulp-svgicons2svgfont@^3.0.1",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/gulp-iconfont",
"author": {
"name": "Nicolas Froidure",
"url": "http://www.insertafter.com/blog.html"
},
"bugs": {
"url": "https://github.com/nfroidure/gulp-svgicons2svgfont/issues"
},
"bundleDependencies": false,
"dependencies": {
"gulp-util": "~3.0.6",
"plexer": "1.0.1",
"readable-stream": "^2.0.2",
"svgicons2svgfont": "^5.0.0"
},
"deprecated": false,
"description": "Create a SVG font from several SVG icons",
"devDependencies": {
"coveralls": "~2.11.4",
"eslint": "^1.4.1",
"eslint-config-simplifield": "^1.1.0",
"event-stream": "~3.3.1",
"gulp": "~3.9.0",
"istanbul": "^0.4.2",
"mkdirp": "^0.5.1",
"mocha": "^2.4.5",
"mocha-lcov-reporter": "^1.0.0",
"neatequal": "^1.0.0",
"rimraf": "^2.5.2",
"streamtest": "^1.2.1"
},
"engines": {
"node": ">= 0.10.0"
},
"homepage": "https://github.com/nfroidure/gulp-svgicons2svgfont",
"keywords": [
"gulpplugin",
"gulp",
"svg",
"icon",
"font"
],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/nfroidure/gulp-svgicons2svgfont/blob/master/LICENSE"
}
],
"main": "src/index.js",
"name": "gulp-svgicons2svgfont",
"repository": {
"type": "git",
"url": "git://github.com/nfroidure/gulp-svgicons2svgfont.git"
},
"scripts": {
"cli": "env NPM_RUN_CLI=1",
"cover": "istanbul cover _mocha --report html -- tests/*.mocha.js -R spec -t 5000",
"coveralls": "istanbul cover _mocha --report lcovonly -- tests/*.mocha.js -R spec -t 5000 && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",
"lint": "eslint src/*.js tests/*.js",
"preversion": "npm run lint && npm test",
"test": "mocha tests/*.mocha.js"
},
"version": "3.0.3"
}

View File

@ -0,0 +1,162 @@
'use strict';
var svgicons2svgfont = require('svgicons2svgfont');
var gutil = require('gulp-util');
var Stream = require('readable-stream');
var path = require('path');
var plexer = require('plexer');
var fileSorter = require('svgicons2svgfont/src/filesorter');
var defaultMetadataProvider = require('svgicons2svgfont/src/metadata');
module.exports = function(options) {
var filesBuffer = [];
var metadataProvider;
var inputStream = new Stream.Transform({ objectMode: true });
var outputStream = new Stream.PassThrough({ objectMode: true });
var stream = plexer({ objectMode: true }, inputStream, outputStream);
var fontStream;
options = options || {};
options.ignoreExt = options.ignoreExt || false;
options.startUnicode = options.startUnicode || 0xEA01;
options.prependUnicode = !!options.prependUnicode;
options.fileName = options.fileName || options.fontName;
if(options.appendUnicode) {
throw new gutil.PluginError(
'svgicons2svgfont',
'The "appendUnicode" option were renamed "prependUnicode".' +
' See https://github.com/nfroidure/gulp-svgicons2svgfont/issues/33'
);
}
if(!options.fontName) {
throw new gutil.PluginError('svgicons2svgfont', 'Missing options.fontName');
}
options.log = options.log || function() {
gutil.log.apply(gutil, ['gulp-svgicons2svgfont:'].concat(
[].slice.call(arguments, 0).concat()));
};
// Emit event containing codepoint mapping
options.callback = function(glyphs) {
stream.emit('glyphs', glyphs.map(function(glyph) {
var finalGlyph = {
name: glyph.name,
unicode: glyph.unicode,
};
if(glyph.color) {
finalGlyph.color = glyph.color;
}
return finalGlyph;
}));
};
options.error = options.error || function() {
stream.emit('error', new gutil.PluginError('svgicons2svgfont',
[].slice.call(arguments, 0).concat()));
};
metadataProvider = options.metadataProvider || defaultMetadataProvider({
startUnicode: options.startUnicode,
prependUnicode: options.prependUnicode,
});
inputStream._transform = function _gulpSVGIcons2SVGFontTransform(file, unused, done) {
var fontFile = null;
var buf = null;
// When null just pass through
if(file.isNull()) {
outputStream.write(file); done();
return;
}
// If the ext doesn't match, pass it through
if((!options.ignoreExt) && '.svg' !== path.extname(file.path)) {
outputStream.write(file); done();
return;
}
if(0 === filesBuffer.length) {
// Generating the font
fontStream = svgicons2svgfont(options);
fontStream.on('error', function(err) {
outputStream.emit('error', err);
});
// Create the font file
fontFile = new gutil.File({
cwd: file.cwd,
base: file.base,
path: path.join(file.base, options.fileName) + '.svg',
});
// Giving the font back to the stream
if(file.isBuffer()) {
buf = new Buffer(''); // use let when going to es6
fontStream.on('data', function(chunk) {
buf = Buffer.concat([buf, chunk], buf.length + chunk.length);
});
fontStream.on('end', function() {
fontFile.contents = buf;
outputStream.push(fontFile);
outputStream.end();
});
} else {
fontFile.contents = fontStream;
outputStream.push(fontFile);
outputStream.end();
}
}
// Otherwise buffer the files
filesBuffer.push(file);
done();
};
inputStream._flush = function _gulpSVGIcons2SVGFontFlush(done) {
var bufferLength = filesBuffer.length;
if(!bufferLength) {
outputStream.end();
return done();
}
// Sorting files
filesBuffer = filesBuffer.sort(function(fileA, fileB) {
return fileSorter(fileA.path, fileB.path);
});
// Wrap icons for the underlying lib
filesBuffer.forEach(function(file) {
var iconStream;
if(file.isBuffer()) {
iconStream = new Stream.PassThrough();
setImmediate(function() {
iconStream.write(file.contents);
iconStream.end();
});
} else {
iconStream = file.contents;
}
metadataProvider(file.path, function(err, theMetadata) {
if(err) {
fontStream.emit('error', err);
}
iconStream.metadata = theMetadata;
fontStream.write(iconStream);
if(0 === --bufferLength) {
fontStream.end();
}
});
});
done();
};
return stream;
};

View File

@ -0,0 +1,42 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<font id="cleanicons" horiz-adv-x="150">
<font-face font-family="cleanicons"
units-per-em="150" ascent="150"
descent="0" />
<missing-glyph horiz-adv-x="0" />
<glyph glyph-name="account"
unicode="&#xE001;"
horiz-adv-x="150" d=" M12.5 10C12.5 10 20.13017 42.95472 29.71798 55.085701C29.71798 55.085701 38.32591 62.128936 42.62986 62.715872C46.93382 63.302809 73.738918 63.889744 73.738918 63.889744L81.760617 73.710766H85.477643L86.651515 89.52096L83.129897 93.237984L81.565209 103.020487L82.152146 107.520567H83.912954C83.912954 107.520567 85.051881 120.238477 84.890706 121.608467C84.730243 122.977747 89.802285 137.793787 102.51948 139.784947C115.23667 141.776827 137.55308 129.276437 137.55308 129.276437L136.34783 107.717407L134.00008 101.064987L135.36936 100.673457C135.36936 100.673457 135.17396 96.956437 133.60855 94.413284C133.60855 94.413284 131.45622 83.65231 125.97838 83.456902L121.67371 70.935119L117.95668 66.825852L115.022 58.21793L129.69541 40.413L130.86928 30.04356C130.86928 30.04356 139.39662 22.43835 137.18722 10.00142H12.5z" />
<glyph glyph-name="arrow-down"
unicode="&#xE002;"
horiz-adv-x="150" d=" M75 30L120 80L30 80z" />
<glyph glyph-name="arrow-left"
unicode="&#xE003;"
horiz-adv-x="150" d=" M50 75L100 120L100 30z" />
<glyph glyph-name="arrow-right"
unicode="&#xE004;"
horiz-adv-x="150" d=" M100 75L50 120L50 30z" />
<glyph glyph-name="arrow-up"
unicode="&#xE005;"
horiz-adv-x="150" d=" M75 80L120 30L30 30z" />
<glyph glyph-name="basket"
unicode="&#xE006;"
horiz-adv-x="150" d=" M10 118.79455L11.71448 106.79316L36.83017 106.79316L48.68117 37.94309L131.51782 37.94309L140 100.08562L47.83896 100.08562L44.77094 118.79455L10 118.79455zM57.012957 30.15271C51.452494 30.15271 46.9366 25.63586 46.9366 20.07636C46.9366 14.5159 51.452494 10 57.012957 10C62.56957 10 67.089311 14.5159 67.089311 20.07636C67.089311 25.63586 62.56957 30.15271 57.012957 30.15271zM121.47154 30.15271C115.91224 30.15271 111.39519 25.63566 111.39519 20.07636C111.39519 14.51706 115.91224 10 121.47154 10C127.03084 10 131.51782 14.51706 131.51782 20.07636C131.51782 25.63566 127.03084 30.15271 121.47154 30.15271z" />
<glyph glyph-name="close"
unicode="&#xE007;"
horiz-adv-x="150" d=" M111.78099 140.000005L74.988545 103.207563L38.219019 139.977089L10.000009 111.758079L46.769534 74.988553L10 38.21902L38.219009 10L74.988543 46.76953L111.75808 10L139.97709 38.21901L103.20755 74.988545L140 111.780991L111.781 140.0000009z" />
<glyph glyph-name="minus"
unicode="&#xE008;"
horiz-adv-x="150" d=" M10 55L140 55L140 90L10 90z" />
<glyph glyph-name="plus"
unicode="&#xE009;"
horiz-adv-x="150" d=" M10 56.974546L56.993232 56.974546L56.993232 10L93.03603 10L93.03603 56.974545L140 56.974545L140 93.025457L93.036035 93.02546L93.036035 140.000005L56.993238 140.000005L56.993238 93.025461L10 93.025461L10 56.974549z" />
<glyph glyph-name="search"
unicode="&#xE00A;"
horiz-adv-x="150" d=" M79.415237 140.00001C51.476382 140.00001 28.83048 116.787 28.83048 88.148484C28.83048 73.559993 34.71965 60.394536 44.17861 50.972995L20 21.23651C24.88406 17.49101 29.76812 13.7455 34.65219 10L60.640939 40.00879C66.448652 37.62664 72.777221 36.29695 79.415237 36.29695C107.3541 36.29695 130 59.509965 130 88.148484C130 116.787 107.3541 140.00001 79.415237 140.00001zM79.415237 127.03713C100.36937 127.03713 117.3538 109.62737 117.3538 88.148484C117.3538 66.669595 100.36937 49.25983 79.415237 49.25983C58.461099 49.25983 41.47667 66.669595 41.47667 88.148484C41.47667 109.62737 58.461099 127.03713 79.415237 127.03713z" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,36 @@
[{
"name":"account",
"unicode": ["\uE001"],
"color": "#F00"
},{
"name":"arrow-down",
"unicode": ["\uE002"],
"color": "#0F0"
},{
"name":"arrow-left",
"unicode": ["\uE003"]
},{
"name":"arrow-right",
"unicode": ["\uE004"],
"color": "#0F0"
},{
"name":"arrow-up",
"unicode": ["\uE005"]
},{
"name":"basket",
"unicode": ["\uE006"]
},{
"name":"close",
"unicode": ["\uE007"]
},{
"name":"minus",
"unicode": ["\uE008"],
"color": "#0F0F0F"
},{
"name":"plus",
"unicode": ["\uE009"]
},{
"name":"search",
"unicode": ["\uE00A"],
"color": "#F7C9F8"
}]

View File

@ -0,0 +1,21 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<font id="originalicons" horiz-adv-x="511.9057">
<font-face font-family="originalicons"
units-per-em="1024" ascent="1024"
descent="0" />
<missing-glyph horiz-adv-x="0" />
<glyph glyph-name="mute"
unicode="&#xEA01;"
horiz-adv-x="439" d=" M439 389.61636V292.61109H341.9947L219.49999 415.1058000000001L97.005274 292.61109H0V389.61636L122.49471 512.11108L0 634.6058V731.6110699999999H97.005274L219.49999 609.11636L341.9947 731.6110699999999H439V634.6058L316.50526 512.11108z" />
<glyph glyph-name="sound"
unicode="&#xEA02;"
horiz-adv-x="439" d=" M55.603405 251.73325C41.371692 251.73325 27.144622 257.16136 16.28608 268.0175900000001C-5.4286933 289.7323600000001 -5.4286933 324.93516 16.28608 346.6499300000001C110.22972 440.5935800000001 110.22972 593.4495000000001 16.28608 687.39083C-5.4286933 709.1056000000001 -5.4286933 744.3107200000001 16.28608 766.02317C38.000843 787.73562 73.203646 787.73562 94.918419 766.02317C232.21978 628.72181 232.21978 405.31664 94.918419 268.0152700000001C84.062188 257.1613600000001 69.832797 251.7332500000001 55.603405 251.7332500000001zM253.11673 146.88936C238.88503 146.88936 224.65795 152.31747 213.79941 163.1737000000001C192.08696 184.8861500000001 192.08696 220.09127 213.79941 241.8060400000001C365.55256 393.5592000000001 365.55256 640.4815600000001 213.79941 792.23473C192.08696 813.94949 192.08696 849.15461 213.79941 870.8670500000001C235.51185 892.57719 270.7193 892.57951 292.43174 870.8670500000001C386.94762 776.3534999999999 439 650.6891 439 517.02269C439 383.35861 386.9476200000001 257.6918900000001 292.43174 163.17601C281.57552 152.3174700000001 267.34613 146.88936 253.11673 146.88936z" />
<glyph glyph-name="speaker"
unicode="&#xEA03;"
horiz-adv-x="511.9057" d=" M458.58066 1007.144596C487.91011 1036.474046 511.90569 1026.533026 511.90569 985.054949V38.94353C511.90569 -2.5345 487.91011 -12.4732999999999 458.5806600000001 16.8562000000001L182.82346 292.61109H-3.417969e-7V731.3874000000001H182.82346L458.58066 1007.144596z" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,30 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<font id="prefixedicons" horiz-adv-x="150">
<font-face font-family="prefixedicons"
units-per-em="150" ascent="150"
descent="0" />
<missing-glyph horiz-adv-x="0" />
<glyph glyph-name="arrow-down"
unicode="&#x11;"
horiz-adv-x="150" d=" M75 30L120 80L30 80z" />
<glyph glyph-name="arrow-up"
unicode="&#x12;"
horiz-adv-x="150" d=" M75 80L120 30L30 30z" />
<glyph glyph-name="arrow-right"
unicode="&#x13;&#x14;"
horiz-adv-x="150" d=" M100 75L50 120L50 30z" />
<glyph glyph-name="arrow-left"
unicode="&#x15;"
horiz-adv-x="150" d=" M50 75L100 120L100 30z" />
<glyph glyph-name="arrow-left-1"
unicode="&#x16;"
horiz-adv-x="150" d=" M50 75L100 120L100 30z" />
<glyph glyph-name="arrow-left-2"
unicode="&#xA011;&#xA012;"
horiz-adv-x="150" d=" M50 75L100 120L100 30z" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,18 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<font id="unicons" horiz-adv-x="100">
<font-face font-family="unicons"
units-per-em="125.334" ascent="125.334"
descent="0" />
<missing-glyph horiz-adv-x="0" />
<glyph glyph-name="twitter"
unicode="&#xEA01;"
horiz-adv-x="100" d=" M6.244 13.664C16.356 12.682 25.285 15.164 33.41 21.234C24.904 21.972 19.242 26.255 16.16 34.195C18.941 33.742 21.553 33.73 24.235 34.439C15.094 37.226 10.286 43.292 9.668 52.926C12.331 51.551 14.949 50.726 17.771 50.594C17.775 50.931 17.481 50.992 17.305 51.13C13.142 54.384 10.674 58.596 10.052 63.868C9.601 67.687 10.332 71.276 12.08 74.681C12.318 75.144 12.439 75.302 12.868 74.794C20.603 65.644 30.315 59.722 42.006 57.078C44.568 56.499 47.17 56.168 49.791 55.979C50.34 55.939 50.494 55.992 50.379 56.639C48.572 66.736 54.706 76.089 64.7 78.232C71.084 79.599 76.734 77.896 81.484 73.387C81.95 72.947 82.338 72.859 82.929 72.996C86.704 73.869 90.271 75.272 93.789 77.312C93.116 75.065 92.067 73.21 90.74 71.503C89.413 69.799 87.801 68.397 85.86 67.114C89.537 67.573 92.885 68.523 96.217 69.835C95.828 69.292 95.451 68.74 95.049 68.207C94.627 67.648 94.195 67.096 93.742 66.563C91.872 64.363 89.804 62.372 87.463 60.676C87.109 60.421 87.092 60.134 87.106 59.774C87.303 53.358 86.374 47.1 84.252 41.049C79.58 27.725 71.27 17.445 58.635 10.882C53.69 8.315 48.413 6.74 42.9 5.944C37.393 5.147 31.885 5.102 26.384 5.964C19.303 7.068 12.722 9.534 6.644 13.338C6.57 13.386 6.502 13.453 6.244 13.664z" />
<glyph glyph-name="facebook"
unicode="&#xEA02;"
horiz-adv-x="54.444" d=" M36.201 3.728H12.02V62.061H0V82.142H12.021V94.233C12.021 110.636 18.808 120.395 38.181 120.395H54.302V100.244H44.261C36.697 100.244 36.2 97.416 36.2 92.183V82.142H54.443L52.321 62.061H36.2V3.728L36.201 3.728L36.201 3.728z" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,24 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<font id="unprefixedicons" horiz-adv-x="150">
<font-face font-family="unprefixedicons"
units-per-em="150" ascent="150"
descent="0" />
<missing-glyph horiz-adv-x="0" />
<glyph glyph-name="arrow-down"
unicode="&#xEA01;"
horiz-adv-x="150" d=" M75 30L120 80L30 80z" />
<glyph glyph-name="arrow-left"
unicode="&#xEA02;"
horiz-adv-x="150" d=" M50 75L100 120L100 30z" />
<glyph glyph-name="arrow-right"
unicode="&#xEA03;"
horiz-adv-x="150" d=" M100 75L50 120L50 30z" />
<glyph glyph-name="arrow-up"
unicode="&#xEA04;"
horiz-adv-x="150" d=" M75 80L120 30L30 30z" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 856 B

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
fill="#F00"
d="m 12.5,140 c 0,0 7.63017,-32.95472 17.21798,-45.085701 0,0 8.60793,-7.043235 12.91188,-7.630171 4.30396,-0.586937 31.109058,-1.173872 31.109058,-1.173872 l 8.021699,-9.821022 h 3.717026 l 1.173872,-15.810194 -3.521618,-3.717024 -1.564688,-9.782503 0.586937,-4.50008 h 1.760808 c 0,0 1.138927,-12.71791 0.977752,-14.0879 -0.160463,-1.36928 4.911579,-16.18532 17.628774,-18.17648 12.71719,-1.99188 35.0336,10.50851 35.0336,10.50851 l -1.20525,21.55903 -2.34775,6.65242 1.36928,0.39153 c 0,0 -0.1954,3.71702 -1.76081,6.260173 0,0 -2.15233,10.760974 -7.63017,10.956382 l -4.30467,12.521783 -3.71703,4.109267 -2.93468,8.607922 14.67341,17.80493 1.17387,10.36944 c 0,0 8.52734,7.60521 6.31794,20.04214 H 12.5 z"
id="path15" />
</svg>

After

Width:  |  Height:  |  Size: 993 B

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
fill="#0F0"
d="M 75,120 120,70 30,70 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 314 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="M 50,75 100,30 100,120 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 296 B

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
x="0px"
y="0px"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
fill="#0F0"
id="path2986"
d="M 100,75 50,30 50,120 z" />
</svg>

After

Width:  |  Height:  |  Size: 324 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="m 75,70 45,50 -90,0 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 295 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="m 10,31.20545 1.71448,12.00139 25.11569,0 11.851,68.85007 82.83665,0 L 140,49.91438 l -92.16104,0 -3.06802,-18.70893 -34.77094,0 z m 47.012957,88.64184 c -5.560463,0 -10.076357,4.51685 -10.076357,10.07635 0,5.56046 4.515894,10.07636 10.076357,10.07636 5.556613,0 10.076354,-4.5159 10.076354,-10.07636 0,-5.5595 -4.519741,-10.07635 -10.076354,-10.07635 z m 64.458583,0 c -5.5593,0 -10.07635,4.51705 -10.07635,10.07635 0,5.5593 4.51705,10.07636 10.07635,10.07636 5.5593,0 10.04628,-4.51706 10.04628,-10.07636 0,-5.5593 -4.48698,-10.07635 -10.04628,-10.07635 z"
id="path15" />
</svg>

After

Width:  |  Height:  |  Size: 829 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="M 111.78099,9.999995 74.988545,46.792437 38.219019,10.022911 10.000009,38.241921 46.769534,75.011447 10,111.78098 38.219009,140 74.988543,103.23047 111.75808,140 139.97709,111.78099 103.20755,75.011455 140,38.219009 111.781,9.9999991 z"
id="rect2986"/>
</svg>

After

Width:  |  Height:  |  Size: 508 B

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
fill="#0F0F0F"
d="m 10,95 130,0 0,-35 L 10,60 z"
id="rect2986" />
</svg>

After

Width:  |  Height:  |  Size: 323 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="m 10,93.025454 46.993232,0 0,46.974546 36.042798,0 0,-46.974545 46.96397,0 0,-36.050912 -46.963965,-3e-6 0,-46.974545 -36.042797,0 0,46.974544 -46.993238,0 0,36.050912 z"
id="rect2986" />
</svg>

After

Width:  |  Height:  |  Size: 443 B

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
fill="#F7C9F8"
d="m 79.415237,9.99999 c -27.938855,0 -50.584757,23.21301 -50.584757,51.851526 0,14.588491 5.88917,27.753948 15.34813,37.175489 L 20,128.76349 c 4.88406,3.7455 9.76812,7.49101 14.65219,11.23651 l 25.988749,-30.00879 c 5.807713,2.38215 12.136282,3.71184 18.774298,3.71184 C 107.3541,113.70305 130,90.490035 130,61.851516 130,33.213 107.3541,9.99999 79.415237,9.99999 z m 0,12.96288 c 20.954133,0 37.938563,17.40976 37.938563,38.888646 0,21.478889 -16.98443,38.888654 -37.938563,38.888654 -20.954138,0 -37.938567,-17.409765 -37.938567,-38.888654 0,-21.478886 16.984429,-38.888646 37.938567,-38.888646 z"
id="path3047" />
</svg>

After

Width:  |  Height:  |  Size: 891 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="439"
height="1024"
viewBox="0 0 439 1024"
id="svg3147">
<path
d="m 439,634.38364 v 97.00527 H 341.9947 L 219.49999,608.8942 97.005274,731.38891 H 0 V 634.38364 L 122.49471,511.88892 0,389.3942 V 292.38893 H 97.005274 L 219.49999,414.88364 341.9947,292.38893 H 439 V 389.3942 L 316.50526,511.88892 z"
id="path3149" />
</svg>

After

Width:  |  Height:  |  Size: 512 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="439"
height="1024"
viewBox="0 0 439 1024"
id="svg3091">
<path
d="m 55.603405,772.26675 c -14.231713,0 -28.458783,-5.42811 -39.317325,-16.28434 -21.7147733,-21.71477 -21.7147733,-56.91757 0,-78.63234 93.94364,-93.94365 93.94364,-246.79957 0,-340.7409 -21.7147733,-21.71477 -21.7147733,-56.91989 0,-78.63234 21.714763,-21.71245 56.917566,-21.71245 78.632339,0 137.301361,137.30136 137.301361,360.70653 0,498.0079 -10.856231,10.85391 -25.085622,16.28202 -39.315014,16.28202 z M 253.11673,877.11064 c -14.2317,0 -28.45878,-5.42811 -39.31732,-16.28434 -21.71245,-21.71245 -21.71245,-56.91757 0,-78.63234 151.75315,-151.75316 151.75315,-398.67552 0,-550.42869 -21.71245,-21.71476 -21.71245,-56.91988 0,-78.63232 21.71244,-21.71014 56.91989,-21.71246 78.63233,0 C 386.94762,247.6465 439,373.3109 439,506.97731 c 0,133.66408 -52.05238,259.3308 -146.56826,353.84668 -10.85622,10.85854 -25.08561,16.28665 -39.31501,16.28665 z"
id="path3103" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="511.9057"
height="1024"
viewBox="0 0 511.9057 1024"
id="svg3194">
<path
d="m 458.58066,16.855404 c 29.32945,-29.32945 53.32503,-19.38843 53.32503,22.089647 V 985.05647 c 0,41.47803 -23.99558,51.41683 -53.32503,22.08733 L 182.82346,731.38891 H -3.4179686e-7 V 292.6126 H 182.82346 L 458.58066,16.855404 z"
id="path3196" />
</svg>

After

Width:  |  Height:  |  Size: 517 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="M 75,120 120,70 30,70 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 297 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="m 75,70 45,50 -90,0 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 295 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
x="0px"
y="0px"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
id="path2986"
d="M 100,75 50,30 50,120 z" />
</svg>

After

Width:  |  Height:  |  Size: 308 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="M 50,75 100,30 100,120 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 296 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="54.444px" height="125.334px" viewBox="270.1 358.167 54.444 125.334"
enable-background="new 270.1 358.167 54.444 125.334" xml:space="preserve">
<path d="M306.301,479.773H282.12V421.44H270.1v-20.081h12.021v-12.091c0-16.403,6.787-26.162,26.16-26.162h16.121v20.151h-10.041
c-7.564,0-8.061,2.828-8.061,8.061v10.041h18.243l-2.122,20.081h-16.121V479.773L306.301,479.773L306.301,479.773z"/>
</svg>

After

Width:  |  Height:  |  Size: 761 B

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100px" height="93.5px" viewBox="0 -5 100 93.5" enable-background="new 0 -5 100 93.5" xml:space="preserve">
<path d="M6.244,74.836c10.112,0.982,19.041-1.5,27.166-7.57c-8.506-0.738-14.168-5.021-17.25-12.961
c2.781,0.453,5.393,0.465,8.075-0.244c-9.141-2.787-13.949-8.853-14.567-18.487c2.663,1.375,5.281,2.2,8.103,2.332
c0.004-0.337-0.29-0.398-0.466-0.536c-4.163-3.254-6.631-7.466-7.253-12.738c-0.451-3.819,0.28-7.408,2.028-10.813
c0.238-0.463,0.359-0.621,0.788-0.113c7.735,9.15,17.447,15.072,29.138,17.716c2.562,0.579,5.164,0.91,7.785,1.099
c0.549,0.04,0.703-0.013,0.588-0.66C48.572,21.764,54.706,12.411,64.7,10.268c6.384-1.367,12.034,0.336,16.784,4.845
c0.466,0.44,0.854,0.528,1.445,0.391c3.775-0.873,7.342-2.276,10.86-4.316c-0.673,2.247-1.722,4.102-3.049,5.809
c-1.327,1.704-2.939,3.106-4.88,4.389c3.677-0.459,7.025-1.409,10.357-2.721c-0.389,0.543-0.766,1.095-1.168,1.628
c-0.422,0.559-0.854,1.111-1.307,1.644c-1.87,2.2-3.938,4.191-6.279,5.887c-0.354,0.255-0.371,0.542-0.357,0.902
c0.197,6.416-0.732,12.674-2.854,18.725c-4.672,13.324-12.982,23.604-25.617,30.167c-4.945,2.567-10.222,4.142-15.735,4.938
c-5.507,0.797-11.015,0.842-16.516-0.02c-7.081-1.104-13.662-3.57-19.74-7.374C6.57,75.114,6.502,75.047,6.244,74.836z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="M 75,120 120,70 30,70 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 297 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="M 50,75 100,30 100,120 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 296 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
x="0px"
y="0px"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
id="path2986"
d="M 100,75 50,30 50,120 z" />
</svg>

After

Width:  |  Height:  |  Size: 308 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="150"
height="150"
viewBox="0 0 150 150"
id="svg2">
<path
d="m 75,70 45,50 -90,0 z"
id="path2986" />
</svg>

After

Width:  |  Height:  |  Size: 295 B

View File

@ -0,0 +1,594 @@
/* eslint max-nested-callbacks:[1] */
'use strict';
var fs = require('fs');
var path = require('path');
var gulp = require('gulp');
var gutil = require('gulp-util');
var rimraf = require('rimraf');
var mkdirp = require('mkdirp');
var assert = require('assert');
var streamtest = require('streamtest');
var neatequal = require('neatequal');
var svgicons2svgfont = require('../src/index');
var defaultMetadataProvider = require('svgicons2svgfont/src/metadata');
describe('gulp-svgicons2svgfont', function() {
beforeEach(function(done) {
mkdirp(path.join(__dirname, 'results'), done);
});
afterEach(function(done) {
rimraf(path.join(__dirname, 'results'), done);
});
streamtest.versions.forEach(function(version) {
describe('for ' + version + ' streams', function() {
describe('must emit an error', function() {
it('when a glyph is bad', function(done) {
streamtest[version].fromObjects([new gutil.File({
path: 'bibabelula.svg',
contents: streamtest.v2.fromChunks(['oh', 'yeah']),
})])
.pipe(svgicons2svgfont({
fontName: 'unprefixedicons',
})
.on('error', function(err) {
assert.equal(
err.message,
'Non-whitespace before first tag.\nLine: 0\nColumn: 1\nChar: o'
);
}).pipe(streamtest.v2.toObjects(function(err) {
if(err) {
return done(err);
}
done();
})));
});
});
describe('with null contents', function() {
it('should let null files pass through', function(done) {
var file = new gutil.File({
path: 'bibabelula.svg',
contents: null,
});
streamtest[version].fromObjects([file])
.pipe(svgicons2svgfont({
fontName: 'cleanicons',
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files[0].path, 'bibabelula.svg');
assert.equal(files[0].contents, null);
assert.equal(files.length, 1);
done();
}));
});
});
it('should let non-svg files pass through (prependUnicode)', function(done) {
var file = new gutil.File({
path: 'bibabelula.foo',
contents: streamtest.v2.fromChunks(['oh', 'yeah']),
});
streamtest[version].fromObjects([file])
.pipe(svgicons2svgfont({
fontName: 'unprefixedicons',
startUnicode: 0xE001,
prependUnicode: true,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files[0].path, 'bibabelula.foo');
assert.equal(files.length, 1);
done();
}));
});
it('should let non-svg files pass through', function(done) {
var file = new gutil.File({
path: 'bibabelula.foo',
contents: streamtest.v2.fromChunks(['oh', 'yeah']),
});
streamtest[version].fromObjects([file])
.pipe(svgicons2svgfont({
fontName: 'unprefixedicons',
startUnicode: 0xE001,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files[0].path, 'bibabelula.foo');
assert.equal(files.length, 1);
done();
}));
});
describe('in stream mode', function() {
it('should work with cleanicons', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'cleanicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'cleanicons',
startUnicode: 0xE001,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
files[0].pipe(streamtest.v2.toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert.equal(
text,
fs.readFileSync(
path.join(__dirname, 'expected', 'test-cleanicons-font.svg'),
'utf8'
)
);
done();
}));
}));
});
it('should work with the metadataProvider option', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'cleanicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'cleanicons',
metadataProvider: defaultMetadataProvider({
startUnicode: 0xE001,
}),
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
files[0].pipe(streamtest.v2.toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert.equal(
text,
fs.readFileSync(
path.join(__dirname, 'expected', 'test-cleanicons-font.svg'),
'utf8'
)
);
done();
}));
}));
});
it('should work with prefixedicons', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'prefixedicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'prefixedicons',
startUnicode: 0xE001,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
files[0].pipe(streamtest.v2.toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert.equal(
text,
fs.readFileSync(
path.join(__dirname, 'expected', 'test-prefixedicons-font.svg'),
'utf8'
)
);
done();
}));
}));
});
it('should work with originalicons', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'originalicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'originalicons',
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
files[0].pipe(streamtest.v2.toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert.equal(
text,
fs.readFileSync(
path.join(__dirname, 'expected', 'test-originalicons-font.svg'),
'utf8'
)
);
done();
}));
}));
});
describe('', function() {
beforeEach(function(done) {
gulp.src(path.join(__dirname, 'fixtures', 'unprefixedicons', '*.svg'))
.pipe(gulp.dest(path.join(__dirname, 'results', 'unprefixedicons')))
.on('error', done)
.on('end', done);
});
it('should work with unprefixed icons and the prependUnicode option', function(done) {
gulp.src(
path.join(__dirname, 'results', 'unprefixedicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'unprefixedicons',
prependUnicode: true,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
files[0].pipe(streamtest.v2.toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert.equal(
text,
fs.readFileSync(
path.join(__dirname, 'expected', 'test-unprefixedicons-font.svg'),
'utf8'
)
);
assert.equal(fs.existsSync(path.join(
__dirname, 'results', 'unprefixedicons', 'uEA01-arrow-down.svg'
)), true);
assert.equal(
fs.readFileSync(path.join(
__dirname, 'results', 'unprefixedicons',
'uEA01-arrow-down.svg'
), 'utf8'),
fs.readFileSync(path.join(
__dirname, 'fixtures', 'unprefixedicons',
'arrow-down.svg'
), 'utf8')
);
assert.equal(fs.existsSync(path.join(
__dirname, 'results', 'unprefixedicons', 'uEA02-arrow-left.svg'
)), true);
assert.equal(
fs.readFileSync(path.join(
__dirname, 'results', 'unprefixedicons',
'uEA02-arrow-left.svg'
), 'utf8'),
fs.readFileSync(path.join(
__dirname, 'fixtures', 'unprefixedicons', 'arrow-left.svg'
), 'utf8')
);
assert.equal(fs.existsSync(path.join(
__dirname, 'results', 'unprefixedicons', 'uEA03-arrow-right.svg'
)), true);
assert.equal(
fs.readFileSync(path.join(
__dirname, 'results', 'unprefixedicons',
'uEA03-arrow-right.svg'
), 'utf8'),
fs.readFileSync(path.join(
__dirname, 'fixtures', 'unprefixedicons', 'arrow-right.svg'
), 'utf8')
);
assert.equal(fs.existsSync(path.join(
__dirname, 'results', 'unprefixedicons', 'uEA04-arrow-up.svg'
)), true);
assert.equal(
fs.readFileSync(path.join(
__dirname, 'results', 'unprefixedicons',
'uEA04-arrow-up.svg'
), 'utf8'),
fs.readFileSync(path.join(
__dirname, 'fixtures', 'unprefixedicons', 'arrow-up.svg'
), 'utf8')
);
done();
}));
}));
});
});
describe('', function() {
beforeEach(function(done) {
gulp.src(path.join(__dirname, 'fixtures', 'unicons', '*.svg'))
.pipe(gulp.dest(path.join(__dirname, 'results', 'unicons')))
.on('error', done)
.on('end', done);
});
it('should work with mixed icons and the prependUnicode option', function(done) {
gulp.src(
path.join(__dirname, 'results', 'unicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'unicons',
prependUnicode: true,
})).on('error', done)
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
files[0].pipe(streamtest.v2.toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert.equal(
text,
fs.readFileSync(
path.join(__dirname, 'expected', 'test-unicons-font.svg'),
'utf8'
)
);
assert.equal(fs.existsSync(path.join(
__dirname, 'results', 'unicons', 'uEA01-twitter.svg'
)), true);
assert.equal(
fs.readFileSync(path.join(
__dirname, 'results', 'unicons',
'uEA01-twitter.svg'
), 'utf8'),
fs.readFileSync(path.join(
__dirname, 'fixtures', 'unicons', 'uEA01-twitter.svg'
), 'utf8')
);
assert.equal(fs.existsSync(path.join(
__dirname, 'results', 'unicons', 'uEA02-facebook.svg'
)), true);
assert.equal(
fs.readFileSync(path.join(
__dirname, 'results', 'unicons',
'uEA02-facebook.svg'
), 'utf8'),
fs.readFileSync(path.join(
__dirname, 'fixtures', 'unicons', 'facebook.svg'
), 'utf8')
);
done();
}));
}));
});
});
it('should emit an event with the codepoint mapping', function(done) {
var codepoints;
gulp.src(
path.join(__dirname, 'fixtures', 'cleanicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'cleanicons',
startUnicode: 0xE001,
}))
.on('glyphs', function(_codepoints_) {
codepoints = _codepoints_;
})
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
files[0].pipe(streamtest.v2.toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert(codepoints);
neatequal(
codepoints,
JSON.parse(fs.readFileSync(
path.join(__dirname, 'expected', 'test-codepoints.json'),
'utf8'
))
);
assert.equal(
text,
fs.readFileSync(
path.join(__dirname, 'expected', 'test-cleanicons-font.svg'),
'utf8'
)
);
done();
}));
}));
});
it('should support filename change', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'cleanicons', '*.svg'),
{ buffer: false }
)
.pipe(svgicons2svgfont({
fontName: 'cleanicons',
fileName: 'newName',
startUnicode: 0xE001,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isStream(), true);
assert.equal(fs.exists(__dirname, 'fixtures', 'cleanicons', 'newName.svg'));
done();
}));
});
});
describe('in buffer mode', function() {
it('should work with cleanicons', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'cleanicons', '*.svg'),
{ buffer: true }
)
.pipe(svgicons2svgfont({
fontName: 'cleanicons',
startUnicode: 0xE001,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isBuffer(), true);
assert.equal(
files[0].contents.toString('utf8'),
fs.readFileSync(path.join(__dirname, 'expected', 'test-cleanicons-font.svg'))
);
done();
}));
});
it('should work with prefixedicons', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'prefixedicons', '*.svg'),
{ buffer: true }
)
.pipe(svgicons2svgfont({
fontName: 'prefixedicons',
startUnicode: 0xE001,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isBuffer(), true);
assert.equal(
files[0].contents.toString('utf8'),
fs.readFileSync(path.join(__dirname, 'expected', 'test-prefixedicons-font.svg'))
);
done();
}));
});
it('should work with originalicons', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'originalicons', '*.svg'),
{ buffer: true }
)
.pipe(svgicons2svgfont({
fontName: 'originalicons',
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isBuffer(), true);
assert.equal(
files[0].contents.toString('utf8'),
fs.readFileSync(path.join(__dirname, 'expected', 'test-originalicons-font.svg'))
);
done();
}));
});
it('should support filename change', function(done) {
gulp.src(
path.join(__dirname, 'fixtures', 'cleanicons', '*.svg'),
{ buffer: true }
)
.pipe(svgicons2svgfont({
fontName: 'cleanicons',
fileName: 'newName',
startUnicode: 0xE001,
}))
.pipe(streamtest.v2.toObjects(function(err, files) {
if(err) {
return done(err);
}
assert.equal(files.length, 1);
assert.equal(files[0].isBuffer(), true);
assert.equal(fs.exists(__dirname, 'fixtures', 'cleanicons', 'newName.svg'));
done();
}));
});
});
});
});
describe('must throw error', function() {
it('when no fontname is given', function() {
assert.throws(function() {
svgicons2svgfont();
});
});
it('when using old options', function() {
assert.throws(function() {
svgicons2svgfont({
appendUnicode: true,
});
});
});
});
});