Created
November 6, 2014 05:19
-
-
Save novwhisky/f4bc2b6f3989c5e259f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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