Skip to content

Commit

Permalink
feat: css classes are now minified instead of hashed in production
Browse files Browse the repository at this point in the history
  • Loading branch information
ephys committed Mar 18, 2020
1 parent 8d364a9 commit b82c9c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -98,6 +98,7 @@
"ip": "^1.1.5",
"json-loader": "^0.5.7",
"lodash": "^4.17.15",
"mini-css-class-name": "^0.9.1",
"mini-css-extract-plugin": "^0.9.0",
"minimist": "^1.2.0",
"mz": "^2.7.0",
Expand Down
7 changes: 7 additions & 0 deletions src/internals/webpack/WebpackBase.js
Expand Up @@ -13,6 +13,7 @@ import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import WebpackBar from 'webpackbar';
import LoadablePlugin from '@loadable/webpack-plugin';
import minifiedCssIdents from 'mini-css-class-name/css-loader';
import { chalkNok, chalkOk } from '../../shared/chalk';
import frameworkConfig from '../../shared/framework-config';
import projectMetadata from '../../shared/project-metadata';
Expand Down Expand Up @@ -300,6 +301,12 @@ export default class WebpackBase {
localIdentName: '[path][name]__[local]--[hash:base64:5]',
},
});
} else {
Object.assign(loaderOptions, {
modules: {
getLocalIdent: minifiedCssIdents(),
},
});
}

// in prod with pre-rendering, we don't generate the CSS. Only the mapping "css class" => "css module class"
Expand Down

0 comments on commit b82c9c4

Please sign in to comment.