gulp-svg2png
Advanced tools
Comparing version 0.2.2 to 0.2.3
24
index.js
@@ -57,2 +57,17 @@ /* | ||
/** | ||
* UUID generator | ||
* | ||
* @return {string} The generated UUID. | ||
* | ||
*/ | ||
function uuid () { | ||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (chr) { | ||
var rand = Math.random() * 16|0; | ||
var value = chr == 'x' ? rand : (rand&0x3|0x8); | ||
return value.toString(16); | ||
}); | ||
} | ||
/** | ||
* Checks if the given file is a SVG. | ||
@@ -62,3 +77,3 @@ * | ||
* | ||
* @return {Boolean} [description] | ||
* @return {Boolean} | ||
* | ||
@@ -102,3 +117,3 @@ */ | ||
function convert (source, cb) { | ||
var temp = path.join(os.tmpdir(), Math.round(Math.random()*1000).toString() + Date.now() + '-' + rename(path.basename(source.path))), | ||
var temp = path.join(os.tmpdir(), uuid() + '-' + rename(path.basename(source.path))), | ||
png; | ||
@@ -116,7 +131,8 @@ | ||
png = new gutil.File({ | ||
path: rename(path.basename(source.path)), | ||
base: source.base, | ||
path: rename(source.path), | ||
contents: data | ||
}); | ||
// Cleanup - Deletes the temp file. | ||
// Cleanup - Delete the temp file. | ||
fs.unlink(temp, done); | ||
@@ -123,0 +139,0 @@ } |
{ | ||
"name": "gulp-svg2png", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A gulp plugin for converting SVGs to PNGs.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -36,2 +36,7 @@ # gulp-svg2png [![Build Status](https://travis-ci.org/akoenig/gulp-svg2png.png?branch=master)](https://travis-ci.org/akoenig/gulp-svg2png) | ||
### Version 0.2.3 (20140404) | ||
- Retain folder hierarchy. | ||
- Implemented UUID for temp file naming. | ||
### Version 0.2.2 (20140221) | ||
@@ -38,0 +43,0 @@ |
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
6720
127
64