Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	index.js
  • Loading branch information
alte0 committed Apr 18, 2022
2 parents fabcb7a + 5581a86 commit 98d89ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var cheerio = require('cheerio'),
events = require('events'),
fs = require('fs'),
gutil = require('gulp-util'),
mkdirp = require('mkdirp'),
Expand Down Expand Up @@ -76,10 +77,14 @@ var spriteSVG = function(options) {
width: 0,
imgName: options.imgName
},
eventEmitter = new events.EventEmitter(),
self,
x = options.x,
y = options.y;

// When a template file is loaded, render it
eventEmitter.on("loadedTemplate", renderTemplate);

// Generate relative em/rem untis from pixels
function pxToRelative(value) {
return value / options.pixelBase;
Expand All @@ -98,7 +103,7 @@ var spriteSVG = function(options) {
dest: dest
};

renderTemplate(file, cb);
eventEmitter.emit("loadedTemplate", file, cb);
});
}

Expand Down Expand Up @@ -291,6 +296,7 @@ var spriteSVG = function(options) {
// Render our template and then save the file
function renderTemplate(file, cb) {
var compiled = mustache.render(file.contents, file.data);

mkdirp(path.dirname(file.dest), function(){
fs.writeFile(file.dest, compiled, cb);
});
Expand Down

0 comments on commit 98d89ee

Please sign in to comment.