site: support import style respectivly

This commit is contained in:
Benjy Cui
2016-04-08 15:29:04 +08:00
parent 2728ea4fa1
commit 71e4a6fb7d
6 changed files with 38 additions and 11 deletions

View File

@@ -2,14 +2,42 @@ const webpack = require('atool-build/lib/webpack');
module.exports = function(webpackConfig) {
if (process.env.ANTD === 'WEBSITE') {
const component = process.env.COMPONENT_STYLE;
webpackConfig.entry = {
index: './site/entry/index.jsx',
};
webpackConfig.resolve.root = process.cwd();
webpackConfig.resolve.alias = {
antd: 'index',
antd: process.cwd(),
BrowserDemo: 'site/component/BrowserDemo',
};
if (component !== undefined) {
const babelConfig = require('atool-build/lib/getBabelCommonConfig')();
babelConfig.plugins.push([
'antd',
{
// style: true,
libDir: 'components',
}
]);
webpackConfig.module.loaders.push({
test: new RegExp(`components/${component}/demo/.*\.md`),
loader: `babel?${JSON.stringify(babelConfig)}!antd-md`,
});
}
const exclude = [/node_modules/];
if (component) {
exclude.push(new RegExp(`components/${component}/demo/.*\.md`));
}
webpackConfig.module.loaders.push({
test: /\.md$/,
exclude: exclude,
loader: `babel!antd-md`,
});
}
if (process.env.ANTD === 'PRODUCTION') {