add gh_pages build

This commit is contained in:
infeng 2016-10-22 10:31:26 +08:00
parent 9a811906f4
commit 296372f194
2 changed files with 44 additions and 1 deletions

View File

@ -7,7 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"start": "dora --port 8001 --plugins \"webpack,webpack-hmr,browser-history?index=/demo/index.html\"",
"lint": "tslint -c tslint.json src/**/*.ts src/**/*.tsx",
"build": "atool-build --config webpack.config.prop.js && gulp"
"build": "atool-build --config webpack.config.prop.js && gulp",
"doc": "atool-build --config webpack.config.doc.js"
},
"repository": {
"type": "git",

42
webpack.config.doc.js Normal file
View File

@ -0,0 +1,42 @@
const webpack = require('atool-build/lib/webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var conf = {
filename: 'index.html',
template: './demo/index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: false
},
hash: true,
}
module.exports = function (webpackConfig) {
webpackConfig.entry = {
index: './demo/index.tsx',
};
webpackConfig.output.path = './docs';
webpackConfig.output.publicPath = '/';
webpackConfig.module.loaders.forEach(function (loader, index) {
if (loader.test.toString().indexOf('html') > 0) {
loader.loader = 'html';
}
});
webpackConfig.plugins.push(
new HtmlWebpackPlugin(conf)
);
webpackConfig.plugins.some(function (plugin, i) {
if (plugin instanceof webpack.optimize.CommonsChunkPlugin) {
webpackConfig.plugins.splice(i, 1);
return true;
}
});
return webpackConfig;
};