提交 9b1bbc85 编写于 作者: A afc163

webpack progress plugin

上级 d46b7904
var path = require('path');
var package = require('./package');
var webpack = require('webpack');
var ProgressPlugin = require('webpack/lib/ProgressPlugin');
var inspect = require('util').inspect;
var Busboy = require('busboy');
var chalk = require('chalk');
var webpackMiddleware = require('webpack-dev-middleware');
var webpackConfig = require('./webpack.config');
var webpackCompiler = webpack(webpackConfig);
var handler;
webpackCompiler.apply(new ProgressPlugin(function(percentage, msg) {
var stream = process.stderr;
if (stream.isTTY && percentage < 0.71) {
stream.cursorTo(0);
stream.write('📦 ' + chalk.green(parseInt(percentage*100)+ '% ') + msg);
stream.clearLine(1);
} else if (percentage === 1) {
console.log(chalk.green('\nwebpack: bundle build is now finished.'));
}
}));
// {{ settings for nico
exports.site = {
name: package.title,
......@@ -72,12 +85,7 @@ exports.middlewares = [
aggregateTimeout: 300,
poll: true
},
stats: {
hash: false,
cached: false,
cachedAssets: false,
colors: true
}
quiet: true
});
try {
return handler(req, res, next);
......
......@@ -68,6 +68,8 @@
"babel": "^5.8.12",
"babel-core": "^5.8.12",
"babel-loader": "^5.3.2",
"busboy": "~0.2.9",
"chalk": "~1.1.0",
"css-animation": "~1.0.3",
"css-loader": "^0.14.1",
"eslint": "^1.1.0",
......@@ -81,8 +83,7 @@
"nico-jsx": "~0.5.8",
"precommit-hook": "^1.0.7",
"webpack": "^1.10.1",
"webpack-dev-middleware": "^1.2.0",
"busboy": "~0.2.9"
"webpack-dev-middleware": "^1.2.0"
},
"scripts": {
"babel": "babel components --out-dir lib",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册