Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: resolve issue #1028: optimising naming for best compression #1062

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Expand Up @@ -963,6 +963,38 @@ module.exports = {
};
```

### Plugin: One Letter CSS

For efficient gzip/br compression, plugin combine css hash via one symbol name,
as a classname position at file, with filepath `hash:base64:8`, to have strong sequences

**webpack.config.js**

```js
const { OneLetterCss } = require('css-loader/plugins');
const MyOneLetterCss = new OneLetterCss();

module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: 'css-loader',
options: {
modules: {
mode: 'local',
localIdentName: '[hash:base64:8]',
// for develop
// localIdentName: '[local]__[hash:base64:8]',
getLocalIdent: MyOneLetterCss.getLocalIdent,
},
},
},
],
},
};
```

## Contributing

Please take a moment to read our contributing guidelines if you haven't yet done so.
Expand Down
4 changes: 2 additions & 2 deletions husky.config.js
@@ -1,6 +1,6 @@
module.exports = {
hooks: {
'pre-commit': 'lint-staged',
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
// 'pre-commit': 'lint-staged',
// 'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
},
};