Skip to content

Instantly share code, notes, and snippets.

@novwhisky
Created November 6, 2014 05:19
Show Gist options
  • Save novwhisky/f4bc2b6f3989c5e259f7 to your computer and use it in GitHub Desktop.
Save novwhisky/f4bc2b6f3989c5e259f7 to your computer and use it in GitHub Desktop.
var path = require('path');
var through = require('through2');
var gutil = require('gulp-util');
module.exports = function beautifyData() {
// creating a stream through which each file will pass
var stream = through.obj(function(file, enc, cb) {
// buffers only for now
if(file.isBuffer()) {
var data = file.contents.toString();
// write the modified data back to the file object
file.contents = new Buffer("`·.¸¸.·´´¯`··._.·" + data + "`·.¸¸.·´´¯`··._.·");
}else{
this.emit("error", new gutil.PluginError("gulp-data-uri-stream", "Only buffers supported", {showStack: true}))
}
// make sure the file goes through the next gulp plugin
this.push(file);
// tell the stream engine that we are done with this file
cb();
});
return stream;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment