-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/)) | ||
|
@@ -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 | ||
}); | ||
``` | ||
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vordgi
Author
Owner
|
||
], 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) |
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