Skip to content

Commit

Permalink
ncm-9 improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vordgi committed Sep 9, 2023
1 parent 3eb3d8e commit 3bc6b74
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Next classnames minifier

Library for configuring style _(css/scss/sass)_ modules to generate compressed classes
Library for configuring style _(css/scss/sass)_ modules to generate compressed classes (`.header` -> `.a`, `.nav` -> `.b`, ..., `.footer` -> `.aad`, etc.)

## Reasons
*Compressing classes* can reduce the size of the generated html and css by up to *20%*, which will have a positive effect on page rendering and metrics (primarily [FCP](https://web.dev/first-contentful-paint/))
Expand All @@ -25,7 +25,7 @@ Create `next.config.js` file in your project and apply the library.
```js
const withClassnamesMinifier = require('next-classnames-minifier').default;

module.exports = withClassnamesMinifier({
module.exports = withClassnamesMinifier()({
// next.js config
});
```
Expand All @@ -36,10 +36,26 @@ const withClassnamesMinifier = require('next-classnames-minifier').default;
const withPlugins = require('next-compose-plugins');

module.exports = withPlugins([
[withClassnamesMinifier]
[withClassnamesMinifier()]

This comment has been minimized.

Copy link
@salexpro

salexpro Jan 8, 2024

man that sucks, you can't change api like that, I spent almost an hour figuring out why the build was failing with a totally unrelated error

This comment has been minimized.

Copy link
@vordgi

vordgi Jan 9, 2024

Author Owner

Thanks for your feedback!
I'm really sorry for that, this was one of the first versions, and, to be honest, I didn't worry about it enough.
And you wrote just in time for a new interesting update! Finally you no longer have to constantly delete the .next folder to keep everything working as expected!

], nextConfig);
```

## Configuration
next-classname-minifier has 3 types of changing classnames:

* minified - the main option. It is highly not recommended to use this option for development mode (_it is too unstable in dev mode_);
* detailed - can be used for debugging, default for development mode;
* none — use the default CSS modules option;

You can choose different options for development and production.

Configuration example:
```js
module.exports = withPlugins([
[withClassnamesMinifier({ dev: 'none', prod: 'minified' })]
], nextConfig);
```

## License

[MIT](https://github.com/vordgi/next-classnames-minifier/blob/main/LICENSE)
[MIT](https://github.com/vordgi/next-classnames-minifier/blob/main/LICENSE)

0 comments on commit 3bc6b74

Please sign in to comment.