Created
July 10, 2016 21:41
-
-
Save ezekielchentnik/34f2363467a8f3b268a278ac6a60ba1b to your computer and use it in GitHub Desktop.
This file contains 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
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