Skip to content

Instantly share code, notes, and snippets.

@ezekielchentnik
Created July 10, 2016 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezekielchentnik/34f2363467a8f3b268a278ac6a60ba1b to your computer and use it in GitHub Desktop.
Save ezekielchentnik/34f2363467a8f3b268a278ac6a60ba1b to your computer and use it in GitHub Desktop.
import webpack from 'webpack';
export default function(name, doneMessage){
return new webpack.ProgressPlugin(function(percentage, message) {
var MOVE_LEFT = new Buffer('1b5b3130303044', 'hex').toString();
var CLEAR_LINE = new Buffer('1b5b304b', 'hex').toString();
process.stdout.write(CLEAR_LINE + 'webpack compiling ['+name+']: ' + Math.round(percentage * 100) + '%: ' + message + MOVE_LEFT);
if(percentage == 1){
process.stdout.write(doneMessage || "webpack say good, fire up...\n");
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment