mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 17:37:14 +00:00
19 lines
499 B
JavaScript
19 lines
499 B
JavaScript
const ProgressBar = require('node-progress-bars')
|
|
const webpack = require('webpack')
|
|
|
|
module.exports = function ProgressPlugin({ color, pcolor, title }) {
|
|
// https://github.com/bubkoo/ascii-progress
|
|
const bar = new ProgressBar({
|
|
schema: `${title}.${color} >.grey :filled.${pcolor}:blank.white :msg.grey`,
|
|
filled: '█',
|
|
blank: '█',
|
|
total: 100,
|
|
width: 25,
|
|
clear: true
|
|
})
|
|
|
|
return new webpack.ProgressPlugin((percent, msg) => {
|
|
bar.update(percent, { msg })
|
|
})
|
|
}
|