diff --git a/README.md b/README.md index d8f8b2a..8fffa99 100644 --- a/README.md +++ b/README.md @@ -1 +1,45 @@ -# Next classnames minifier \ No newline at end of file +# Next classnames minifier + +Library for configuring style _(css/scss/sass)_ modules to generate compressed classes + +## 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/)) + +## Installation + +**Using npm:** +```bash +npm i next-classnames-minifier +``` + +**Using yarn:** +```bash +yarn add next-classnames-minifier +``` + +## Usage + +Create `next.config.js` file in your project and apply the library. + +**Base:** +```js +const withClassnamesMinifier = require('next-classnames-minifier').default; + +module.exports = withClassnamesMinifier({ + // next.js config +}); +``` + +**With `next-compose-plugins`:** +```js +const withClassnamesMinifier = require('next-classnames-minifier').default; +const withPlugins = require('next-compose-plugins'); + +module.exports = withPlugins([ + [withClassnamesMinifier] +], nextConfig); +``` + +## License + +[MIT](https://github.com/vordgi/next-classnames-minifier/blob/main/LICENSE) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5f9e130..3be608a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "next-themeizer", + "name": "next-classnames-minifier", "version": "0.0.2", "lockfileVersion": 1, "requires": true, @@ -431,14 +431,6 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "node-fetch": { - "version": "2.6.6", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz", - "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, "node-releases": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", @@ -555,19 +547,6 @@ "terser": "^5.7.2" } }, - "themeizer": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/themeizer/-/themeizer-0.1.4.tgz", - "integrity": "sha512-p52ItG04P30QRB+RUxQJHA/wcJ/Puke4pMHT3V7hT5dMPKxdwV0mdR77tnXkZgMjlbJ4SrT8YjVOAo9Mgvl6NQ==", - "requires": { - "node-fetch": "2.6.6" - } - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" - }, "typescript": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", @@ -593,11 +572,6 @@ "graceful-fs": "^4.1.2" } }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" - }, "webpack": { "version": "5.65.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", @@ -635,15 +609,6 @@ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.2.tgz", "integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==", "dev": true - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } } } } diff --git a/package.json b/package.json index dc43831..91a6925 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,28 @@ { "name": "next-classnames-minifier", - "version": "0.0.1", - "description": "", + "version": "0.0.2", + "description": "Library for configuring style modules to generate compressed classes", "main": "dist/withClassnamesMinifier.js", "types": "dist/withClassnamesMinifier.d.ts", "files": [ "dist" ], "scripts": { - "start": "ts-node index.ts", "build": "tsc" }, - "keywords": [], + "keywords": [ + "next", + "next.js", + "classname", + "class", + "minify", + "compress", + "cut", + "css", + "sass", + "scss", + "modules" + ], "repository": { "type": "git", "url": "git://github.com/vordgi/next-classnames-minifier.git"