Skip to content

Commit

Permalink
Generate hashes and minimize code on prod build
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroPerezMartin committed Dec 18, 2018
1 parent 4e3d6f4 commit f38268a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path');

const task = process.argv[2] || 'default';
const env = process.env.NODE_ENV || 'production';
const isProduction = env === 'production';
const isProduction = task === 'prod' || env === 'production';
const prefix = process.env.CK_PREFIX || 'clientkit';
const baseConfig = process.env.CK_BASE_CONFIG || path.join(__dirname, 'conf');
const primaryConfig = process.env.CK_CONFIG || path.join(process.cwd(), prefix);
Expand Down
2 changes: 1 addition & 1 deletion webpack/configs/css/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = config => {
]
};

if (paths.isProduction || paths.task !== 'dev') {
if (paths.isProduction) {
cssConfig.plugins.push(assetsManifest(config));
}

Expand Down
2 changes: 1 addition & 1 deletion webpack/configs/css/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = config => {
}
};

if (cssConfig.minify || paths.task !== 'dev') {
if (cssConfig.minify || paths.isProduction) {
postCSSLoader.options.plugins.push(require('cssnano')({
zindex: false,
reduceIdents: false
Expand Down
2 changes: 1 addition & 1 deletion webpack/configs/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = config => {
plugins: []
};

if (paths.isProduction || paths.task !== 'dev') {
if (paths.isProduction) {
jsConfig.plugins.push(assetsManifest(config));
}

Expand Down
2 changes: 1 addition & 1 deletion webpack/configs/svg/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = config => {
]
};

if (paths.isProduction || paths.task !== 'dev') {
if (paths.isProduction) {
svgConfig.plugins.push(assetsManifest(config));
}

Expand Down
2 changes: 1 addition & 1 deletion webpack/get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const getConfig = async () => {
}
},
optimization: {
minimize: config.minify || paths.task !== 'dev',
minimize: config.minify || paths.isProduction,
noEmitOnErrors: true
},
target: 'web',
Expand Down

0 comments on commit f38268a

Please sign in to comment.