gulp-cssfont64-formatter
Advanced tools
Comparing version 0.0.1 to 0.0.2
15
index.js
@@ -15,3 +15,8 @@ 'use strict'; | ||
module.exports = function (formatter) { | ||
module.exports = function (opts) { | ||
// For backwardscompatability, if its a function it means a formatter. Else expects a config-object. | ||
var options = typeof opts === 'function' ? { | ||
formatter: opts | ||
} : opts; | ||
// create a stream through which each file will pass | ||
@@ -38,4 +43,4 @@ return through.obj(function (file, enc, callback) { | ||
var csswrapper = ''; | ||
if (formatter) { | ||
csswrapper = formatter(filename, mtype, file64, format); | ||
if (options.formatter) { | ||
csswrapper = options.formatter(filename, mtype, file64, format); | ||
} else { | ||
@@ -45,4 +50,6 @@ csswrapper = '@font-face {font-family: ' + filename + '; src: url(data:' + mtype + ';base64,' + file64 + ') format("' + format + '");}'; | ||
var extention = options.extention ? options.extention : 'css'; | ||
file.contents = new Buffer(csswrapper); | ||
file.path = gutil.replaceExtension(file.path, '.css'); | ||
file.path = gutil.replaceExtension(file.path, '.' + extention); | ||
return callback(null, file); | ||
@@ -49,0 +56,0 @@ } |
{ | ||
"name": "gulp-cssfont64-formatter", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Encode base64 data from font-files and store the result in a css file.", | ||
@@ -14,3 +14,8 @@ "main": "index.js", | ||
"keywords": [ | ||
"gulpplugin", "encode", "base64", "font", "css", "ttf" | ||
"gulpplugin", | ||
"encode", | ||
"base64", | ||
"font", | ||
"css", | ||
"ttf" | ||
], | ||
@@ -17,0 +22,0 @@ "author": { |
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
6862
68