Skip to content

Commit

Permalink
added config files
Browse files Browse the repository at this point in the history
  • Loading branch information
foxhound87 committed Nov 9, 2016
1 parent e653122 commit 7d2e625
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 25 deletions.
21 changes: 10 additions & 11 deletions webpack/postcss/postcss.config.js → config/postcss.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint import/no-extraneous-dependencies: 0 */
import postcssImport from 'postcss-import';
import postcssExtend from 'postcss-extend';
import postcssFocus from 'postcss-focus';
Expand All @@ -6,14 +7,12 @@ import autoprefixer from 'autoprefixer';
import precss from 'precss';
import cssnano from 'cssnano';

export default function getConfig(bundler) {
return [
postcssImport({ addDependencyTo: bundler }),
postcssUrl('inline'),
postcssExtend(),
postcssFocus(),
autoprefixer(),
precss(),
cssnano(),
];
}
export default bundler => [
postcssImport({ addDependencyTo: bundler }),
postcssUrl('inline'),
postcssExtend(),
postcssFocus(),
autoprefixer(),
precss(),
cssnano(),
];
12 changes: 12 additions & 0 deletions config/vendor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
Vendor for webpack code splitting
*/

export default [
'react',
'react-dom',
'mobx',
'mobx-react',
'bluebird',
'socket.io-client',
];
1 change: 0 additions & 1 deletion src/shared/containers/AppLayout.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import Helmet from 'react-helmet';
// import { connect } from '~/src/utils/state';
import { observer } from 'mobx-react';

import cx from 'classnames';
Expand Down
1 change: 0 additions & 1 deletion src/shared/containers/Breakpoints.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import Helmet from 'react-helmet';
// import { connect } from '~/src/utils/state';
import { observer } from 'mobx-react';
import cx from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion src/shared/containers/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import Helmet from 'react-helmet';
// import { connect } from '~/src/utils/state';
import { observer } from 'mobx-react';
import cx from 'classnames';

Expand Down
1 change: 0 additions & 1 deletion src/shared/containers/Messages.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import Helmet from 'react-helmet';
// import { connect } from '~/src/utils/state';
import { observer } from 'mobx-react';
import cx from 'classnames';

Expand Down
6 changes: 3 additions & 3 deletions webpack/config.client.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import ProgressBarPlugin from 'progress-bar-webpack-plugin';
import webpack from 'webpack';
import path from 'path';

import vendor from '~/config/vendor';

const Dir = global.DIR;

export function loader() {
Expand Down Expand Up @@ -42,15 +44,13 @@ export function config() {
bail: true,
devtool: 'source-map',
entry: {
vendor,
app: [
'babel-polyfill',
'isomorphic-fetch',
'whatwg-fetch',
path.join(Dir.web, 'client'),
],
vendor: [
'react', 'react-dom', 'mobx', 'mobx-react', 'bluebird', 'socket.io-client',
],
},
output: {
path: path.join(Dir.public, 'build'),
Expand Down
6 changes: 3 additions & 3 deletions webpack/config.client.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import webpack from 'webpack';
import getenv from 'getenv';
import path from 'path';

import vendor from '~/config/vendor';

const Dir = global.DIR;

const webhost = ['http://', getenv('WEB_HOST'), ':', getenv('WEB_PORT')].join('');
Expand Down Expand Up @@ -38,6 +40,7 @@ export function config() {
return {
devtool: 'cheap-module-eval-source-map',
entry: {
vendor,
app: [
'babel-polyfill',
'isomorphic-fetch',
Expand All @@ -47,9 +50,6 @@ export function config() {
// ['webpack-hot-middleware/client', webhost].join('?'),
path.join(Dir.web, 'client'),
],
vendor: [
'react', 'react-dom', 'mobx', 'mobx-react', 'bluebird', 'socket.io-client',
],
},
output: {
path: '/',
Expand Down
4 changes: 2 additions & 2 deletions webpack/config.client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import webpack from 'webpack';
import getenv from 'getenv';
import env from '~/config/expose';
import getPostCSSConfig from './postcss/postcss.config';
import postcss from '~/config/postcss';

export function load() {
return {
Expand All @@ -25,7 +25,7 @@ export function load() {
minimize: false,
debug: true,
options: {
postcss: getPostCSSConfig(webpack, {}),
postcss: postcss(webpack),
},
}),
],
Expand Down
4 changes: 2 additions & 2 deletions webpack/config.server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import webpack from 'webpack';
import getenv from 'getenv';
import env from '~/config/expose';
import getPostCSSConfig from './postcss/postcss.config';
import postcss from '~/config/postcss';

export function load() {
return {
Expand All @@ -23,7 +23,7 @@ export function load() {
minimize: true,
debug: false,
options: {
postcss: getPostCSSConfig(webpack, {}),
postcss: postcss(webpack),
},
}),
],
Expand Down

0 comments on commit 7d2e625

Please sign in to comment.