gulp-ttf2eot
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "gulp-ttf2eot", | ||
"description": "Create an EOT font from a TTF font", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "https://github.com/nfroidure/gulp-ttf2eot", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -36,2 +36,3 @@ var Stream = require('stream') | ||
options.ignoreExt = options.ignoreExt || false; | ||
options.clone = options.clone || false; | ||
@@ -52,2 +53,6 @@ var stream = new Stream.Transform({objectMode: true}); | ||
} | ||
if(options.clone) { | ||
stream.push(file.clone()); | ||
} | ||
@@ -54,0 +59,0 @@ file.path = gutil.replaceExtension(file.path, ".eot"); |
@@ -53,2 +53,3 @@ 'use strict'; | ||
var n = 0; | ||
gulp.src(filename + '.ttf') | ||
@@ -59,6 +60,9 @@ .pipe(ttf2eot()) | ||
.pipe(es.through(function(file) { | ||
assert.equal(file.path, filename + '.eot'); | ||
assert.equal(file.contents.length, eot.length); | ||
assert.equal(file.contents.toString('utf-8'), eot.toString('utf-8')); | ||
n++; | ||
}, function() { | ||
done(); | ||
assert.equal(n,1); | ||
done(); | ||
})); | ||
@@ -68,10 +72,35 @@ | ||
it('should work with the clone option', function(done) { | ||
var n = 0; | ||
gulp.src(filename + '.ttf', {buffer: true}) | ||
.pipe(ttf2eot({clone: true})) | ||
.pipe(es.through(function(file) { | ||
if(file.path === filename + '.eot') { | ||
assert.equal(file.contents.length, eot.length); | ||
assert.equal(file.contents.toString('utf-8'), eot.toString('utf-8')); | ||
} else { | ||
assert.equal(file.path, filename + '.ttf'); | ||
assert.equal(file.contents.toString('utf-8'), | ||
fs.readFileSync(filename + '.ttf','utf-8')); | ||
} | ||
n++; | ||
}, function() { | ||
assert.equal(n,2); | ||
done(); | ||
})); | ||
}); | ||
it('should let non-ttf files pass through', function(done) { | ||
var s = ttf2eot(); | ||
var s = ttf2eot() | ||
, n = 0; | ||
s.pipe(es.through(function(file) { | ||
assert.equal(file.path,'bibabelula.foo'); | ||
assert.equal(file.contents.toString('utf-8'), 'ohyeah'); | ||
n++; | ||
}, function() { | ||
done(); | ||
assert.equal(n,1); | ||
done(); | ||
})); | ||
@@ -92,5 +121,7 @@ s.write(new gutil.File({ | ||
var n = 0; | ||
gulp.src(filename + '.ttf', {buffer: false}) | ||
.pipe(ttf2eot()) | ||
.pipe(es.through(function(file) { | ||
assert.equal(file.path, filename + '.eot'); | ||
// Get the buffer to compare results | ||
@@ -101,4 +132,6 @@ file.contents.pipe(es.wait(function(err, data) { | ||
})); | ||
n++; | ||
}, function() { | ||
done(); | ||
assert.equal(n,1); | ||
done(); | ||
})); | ||
@@ -108,10 +141,38 @@ | ||
it('should work with the clone option', function(done) { | ||
var n = 0; | ||
gulp.src(filename + '.ttf', {buffer: false}) | ||
.pipe(ttf2eot({clone: true})) | ||
.pipe(es.through(function(file) { | ||
if(file.path === filename + '.eot') { | ||
file.contents.pipe(es.wait(function(err, data) { | ||
assert.equal(data.length, eot.toString('utf-8').length); | ||
assert.equal(data, eot.toString('utf-8')); | ||
})); | ||
} else { | ||
assert.equal(file.path, filename + '.ttf'); | ||
file.contents.pipe(es.wait(function(err, data) { | ||
assert.equal(data, fs.readFileSync(filename + '.ttf','utf-8')); | ||
})); | ||
} | ||
n++; | ||
}, function() { | ||
assert.equal(n,2); | ||
done(); | ||
})); | ||
}); | ||
it('should let non-ttf files pass through', function(done) { | ||
var s = ttf2eot(); | ||
var s = ttf2eot() | ||
, n = 0; | ||
s.pipe(es.through(function(file) { | ||
assert.equal(file.path,'bibabelula.foo', {buffer: false}); | ||
assert(file.contents instanceof Stream.PassThrough); | ||
n++; | ||
}, function() { | ||
done(); | ||
assert.equal(n,1); | ||
done(); | ||
})); | ||
@@ -118,0 +179,0 @@ s.write(new gutil.File({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15123
222