diff --git a/client/index.js b/client/index.js index f37d06f4..ada79c22 100644 --- a/client/index.js +++ b/client/index.js @@ -4,6 +4,7 @@ import App from './Application' import { Provider } from 'react-redux' import createStore from './reducer/create'; import { DevTools } from './containers'; +import './styles/theme.less' const store = createStore(); diff --git a/client/styles/theme.less b/client/styles/theme.less new file mode 100644 index 00000000..b7f73e0b --- /dev/null +++ b/client/styles/theme.less @@ -0,0 +1,4 @@ +@import '~antd/dist/antd.less'; + + +@primary-color : blue; \ No newline at end of file diff --git a/package.json b/package.json index 0972c053..3fd101a0 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,8 @@ "koa-static": "^3.0.0", "koa-views": "^5.2.0", "koa-websocket": "^4.0.0", + "less": "^2.7.2", + "less-loader": "^4.0.5", "mock": "^0.1.1", "mockjs": "^1.0.1-beta3", "moment": "^2.18.1", diff --git a/ykit.js b/ykit.js index 7d3b2f98..03a3b7c3 100644 --- a/ykit.js +++ b/ykit.js @@ -9,22 +9,22 @@ var assetsPluginInstance = new AssetsPlugin({ function handleCommonsChunk(webpackConfig) { var commonsChunk = { - //filename: 'scripts/[name]@[chunkhash][ext]', - vendors: { - lib: ['react', 'redux', - 'redux-thunk', - 'react-dom', - 'redux-promise', - 'react-router-dom', - 'prop-types' + //filename: 'scripts/[name]@[chunkhash][ext]', + vendors: { + lib: ['react', 'redux', + 'redux-thunk', + 'react-dom', + 'redux-promise', + 'react-router-dom', + 'prop-types' - ], - lib2: [ - 'axios', - 'moment' - ] - } - }, + ], + lib2: [ + 'axios', + 'moment' + ] + } + }, chunks = [], filenameTpl = webpackConfig.output[this.env], vendors; @@ -78,7 +78,7 @@ module.exports = { "regenerator": true }]); defaultQuery.plugins.push('transform-decorators-legacy'); - defaultQuery.plugins.push(["import", { libraryName: "antd", style: "css" }]) + // defaultQuery.plugins.push(["import", { libraryName: "antd", style: "css" }]) return defaultQuery; } } @@ -102,8 +102,8 @@ module.exports = { ENV_PARAMS = { development: false }; break; default: - } - + } + baseConfig.plugins.push(new this.webpack.DefinePlugin({ ENV_PARAMS: JSON.stringify(ENV_PARAMS) })) @@ -117,7 +117,15 @@ module.exports = { //commonsChunk handleCommonsChunk.call(this, baseConfig) - + baseConfig.module.loaders.push({ + test: /\.less$/, + loader: ykit.ExtractTextPlugin.extract( + require.resolve('style-loader'), + require.resolve('css-loader') + + '?sourceMap!' + + require.resolve('less-loader') + '?sourceMap' + ) + }) baseConfig.module.loaders.push({ test: /\.(sass|scss)$/, loader: ykit.ExtractTextPlugin.extract(