Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1275 from govau/ji-skin-name-env-var
Browse files Browse the repository at this point in the history
Rename CF_SKIN to SKIN_NAME
  • Loading branch information
jcscottiii authored Nov 9, 2017
2 parents 4a0325c + b9d6a47 commit 1e1ab77
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export SECURE_COOKIES=true
# needed before anything insecure can be used (e.g. insecure cookies.)
# export LOCAL_CF=0

# <optional> Which skin to use (defaults to cg)
# export CF_SKIN=cg
# <optional> The name of the skin to use (defaults to cg)
# export SKIN_NAME=cg

# The SMTP HOST for mailcatcher
export SMTP_HOST=localhost
Expand Down
33 changes: 19 additions & 14 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ const webpack = require('webpack');

const ExtractTextPlugin = require('extract-text-webpack-plugin');

const PRODUCTION = (process.env.NODE_ENV === 'prod');
const TEST = (process.env.NODE_ENV === 'test');
const PRODUCTION = process.env.NODE_ENV === 'prod';
const TEST = process.env.NODE_ENV === 'test';
const CG_STYLE_PATH = process.env.CG_STYLE_PATH;
const CF_SKIN = process.env.CF_SKIN || 'cg';

const SKIN_NAME = process.env.SKIN_NAME || 'cg';

const srcDir = './static_src';
const compiledDir = './static/assets';

const config = {
bail: false,

entry: [
'babel-polyfill',
`${srcDir}/main.js`
],
entry: ['babel-polyfill', `${srcDir}/main.js`],

output: {
path: path.resolve(compiledDir),
Expand Down Expand Up @@ -49,7 +47,8 @@ const config = {
test: /\.(svg|ico|png|gif|jpe?g)$/,
loader: 'url-loader?limit=1024&name=img/[name].[ext]'
},
{ test: /\.(ttf|woff2?|eot)$/,
{
test: /\.(ttf|woff2?|eot)$/,
loader: 'url-loader?limit=1024&name=font/[name].[ext]'
}
]
Expand All @@ -59,7 +58,7 @@ const config = {
alias: {
'cloudgov-style': 'cloudgov-style',
dashboard: path.resolve(__dirname, 'static_src'),
skin: path.resolve(__dirname, `static_src/skins/${CF_SKIN}`)
skin: path.resolve(__dirname, `static_src/skins/${SKIN_NAME}`)
},

modules: ['node_modules'],
Expand Down Expand Up @@ -95,12 +94,18 @@ if (TEST) {
};
}

const processEnv = {
SKIN_NAME: JSON.stringify(SKIN_NAME)
};

if (PRODUCTION) {
config.plugins.push(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}));
processEnv.NODE_ENV = JSON.stringify('production');
}

config.plugins.push(
new webpack.DefinePlugin({
'process.env': processEnv
})
);

module.exports = config;

0 comments on commit 1e1ab77

Please sign in to comment.