{"_id":"@aaashur/eleventy-plugin-classnames","_rev":"1-d7ebb9335a6ca6410249f291da8f9b74","name":"@aaashur/eleventy-plugin-classnames","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@aaashur/eleventy-plugin-classnames","version":"0.1.0","description":"An Eleventy shortcode for joining truthy, non-duplicate argument values into a space-delimited string","main":".eleventy.js","scripts":{"lint":"eslint '.eleventy.js' 'src/**/*.js' 'test/**/*.js'","test":"mocha ./test"},"repository":{"type":"git","url":"git+https://github.com/ashur/eleventy-plugin-classnames.git"},"keywords":["11ty","11ty-plugin","eleventy","eleventy-plugin"],"author":{"name":"Ashur Cabrera","url":"https://ashur.cab/rera"},"license":"ISC","bugs":{"url":"https://github.com/ashur/eleventy-plugin-classnames/issues"},"homepage":"https://github.com/ashur/eleventy-plugin-classnames#readme","devDependencies":{"@11ty/eleventy":"^2.0.0","chai":"^4.3.7","eslint":"^8.35.0","eslint-plugin-sort-requires":"^2.1.0","mocha":"^10.2.0"},"eslintIgnore":["!.*"],"gitHead":"6cd2a591a9426fb605759ee73e6252eed08c8b1b","_id":"@aaashur/eleventy-plugin-classnames@0.1.0","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-IK0a2DQ3ZLqAOfNz9NyxEX/7kM2C3nufY4jQnUZzOOt8vUq9IZYGVGOJ78hJpcIUxDtwp3ClphFOel6zYDhvXg==","shasum":"0ec81f8d349f30c87942871088f07ae1969fe4b2","tarball":"https://registry.npmjs.org/@aaashur/eleventy-plugin-classnames/-/eleventy-plugin-classnames-0.1.0.tgz","fileCount":8,"unpackedSize":4849,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGslblUMc+mELTBD8I2nQVPyEuvZYJKPlEfMmIQiX0MeAiAUPdd5V5eJw3t/7qvfgPAI2fmae3CTUPWD/RLVXBn3EA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj/to8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpWFg/+Mf50Pn1a+hOPzp4zAPI4LL0A+C77UhH3e9GuWl9ZmmRVZXt9\r\nxg3oFiig0Wy/5oTQzbTwoYigTLhmEtWH9LARk7G2gx4yMgFtfJ0uGfBI5vzI\r\nUHn6KMoR97RM0rr8PHeywx/siSjDgHVVxwOGWr0Jy3MdCUpzFesVycu4ZybQ\r\nrJ8OtxB5I/EiJsENkQMtR742OcYUlFCYNJY9JFnG/gpHEI3RpsF5khw+7QWi\r\nf7r6q6X/9yTPf4FLsTB2lwEs+MHGvhztYsIVl2hapX3XCmPohutH66NuX3QS\r\n4dILU/0sBUv/EFgz78KYANrwR8uy1a7rxj9or9Uo9Gl5KElryqRJt5CkfNcn\r\nQxCXWyN9CHHPbrYjjmZXig9rAzeAXO+l4T0vLLuNtRvtQdMpygBkCiSzF34w\r\nLzcneqSuL/8kpWs5mAi+CKe5zXMX3/oi5imOt6wGDsbyH7jViw7xcAlVyT5v\r\nrUmH647fRkbgMxXyElZlzrBScDhvpH5QCl9H/p3YHTbICsb69OZnzXakT18W\r\nsH0sNUpBSS66CVrO/f4LIMOO4tZUqaCOqRDAhCagGkReLRZrN/HRrGSQKsE9\r\nJGISEg0e/bhBezC9iWMisI3ROmLUcMZCuHAA8gzqCA/SzhOkHNeZE76XWk/f\r\ncMjeHGjY/NmX+6FQsh/d+W/fDJDuTpRQbFc=\r\n=odAz\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aaashur","email":"hello@ashur.cab"},"directories":{},"maintainers":[{"name":"aaashur","email":"hello@ashur.cab"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eleventy-plugin-classnames_0.1.0_1677646396301_0.11841117812398139"},"_hasShrinkwrap":false},"0.2.0":{"name":"@aaashur/eleventy-plugin-classnames","version":"0.2.0","description":"An Eleventy plugin for joining truthy, deduplicated values into a space-delimited string","main":".eleventy.js","scripts":{"lint":"eslint '.eleventy.js' 'src/**/*.js' 'test/**/*.js'","test":"mocha ./test"},"repository":{"type":"git","url":"git+https://github.com/ashur/eleventy-plugin-classnames.git"},"keywords":["11ty","11ty-plugin","eleventy","eleventy-plugin"],"author":{"name":"Ashur Cabrera","url":"https://ashur.cab/rera"},"license":"ISC","bugs":{"url":"https://github.com/ashur/eleventy-plugin-classnames/issues"},"homepage":"https://github.com/ashur/eleventy-plugin-classnames#readme","devDependencies":{"@11ty/eleventy":"^2.0.0","chai":"^4.3.7","eslint":"^8.35.0","eslint-plugin-sort-requires":"^2.1.0","mocha":"^10.2.0"},"eslintIgnore":["!.*"],"gitHead":"cab9bfd109bb9e46cda4ae2d4553bffacc29d706","_id":"@aaashur/eleventy-plugin-classnames@0.2.0","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-iaxQA11VzJNgy8eQ8LmZaw7rHimH2sjaMDEUelYnX69zrWQ/yl+38IpW0AzP61+ZNU9cUkOg6QRYroYMzLo3Jw==","shasum":"62eb63e638a07ef8972a76acccabedf0acf598bb","tarball":"https://registry.npmjs.org/@aaashur/eleventy-plugin-classnames/-/eleventy-plugin-classnames-0.2.0.tgz","fileCount":8,"unpackedSize":6166,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE+RkgLyRGj43rdwMJbFkoQGtv3rIPT2e8xJj9pT14+MAiB9Pf5vZevaaIPmXNVPcbfY6bv4pWq/O+KlPbrKjIXZEg=="}]},"_npmUser":{"name":"aaashur","email":"hello@ashur.cab"},"directories":{},"maintainers":[{"name":"aaashur","email":"hello@ashur.cab"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eleventy-plugin-classnames_0.2.0_1684875127735_0.30241735244640355"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-01T04:53:16.240Z","0.1.0":"2023-03-01T04:53:16.481Z","modified":"2023-05-23T20:52:08.034Z","0.2.0":"2023-05-23T20:52:07.940Z"},"maintainers":[{"name":"aaashur","email":"hello@ashur.cab"}],"description":"An Eleventy plugin for joining truthy, deduplicated values into a space-delimited string","homepage":"https://github.com/ashur/eleventy-plugin-classnames#readme","keywords":["11ty","11ty-plugin","eleventy","eleventy-plugin"],"repository":{"type":"git","url":"git+https://github.com/ashur/eleventy-plugin-classnames.git"},"author":{"name":"Ashur Cabrera","url":"https://ashur.cab/rera"},"bugs":{"url":"https://github.com/ashur/eleventy-plugin-classnames/issues"},"license":"ISC","readme":"# eleventy-plugin-classnames\n\nAn [Eleventy](https://11ty.dev/) plugin — available as a filter and a shortcode — for joining truthy, deduplicated values into a space-delimited string, suitable for use in an HTML element's `class` attribute:\n\n```javascript\nclassnames(\n  \"block\",\n  \"block__element\",\n  false && \"block__element--modifier\",\n  \"block\",\n)\n// returns \"block block__element\"\n```\n\n> Inspired by the [classnames](https://www.npmjs.com/package/classnames) package by [JedWatson](https://github.com/JedWatson/classnames)\n\n## Setup\n\nRun the following command at the root of your Eleventy project\n\n```shell\nnpm install @aaashur/eleventy-plugin-classnames\n```\n\nthen include it in your `.eleventy.js` config file:\n\n```javascript\nconst classnames = require(\"@aaashur/eleventy-plugin-classnames\");\n\nmodule.exports = (eleventyConfig) => {\n    eleventyConfig.addPlugin(classnames);\n};\n```\n\n## Usage\n\n`classnames` is exposed both as a [filter](https://www.11ty.dev/docs/filters/) and as a [shortcode](https://www.11ty.dev/docs/shortcodes/) everywhere Eleventy supports them.\n\n### Filter\n\n> ✨ Added in v0.2.0\n\nYou might use the filter in a [WebC template](https://www.11ty.dev/docs/languages/webc/) like this:\n\n```html\n---\ncolor: turquoise\nprimary: false\nsectionTitle: Section Title\n---\n<h2 :class=\"classnames(\n        'block__element',\n        primary && 'block__element--primary',\n        color && 'block__element--' + color,\n    )\"\n    @text=\"sectionTitle\"\n></h2>\n```\n\nwhich would return:\n\n```html\n<h2 class=\"block__element block__element--turquoise\">\n    Section Title\n</h2>\n```\n\n### Shortcode\n\nYou might use the shortcode in a [Nunjucks template](https://www.11ty.dev/docs/languages/nunjucks/) like this:\n\n```njk\n{%- set color = \"turquoise\" -%}\n{%- set primary = false -%}\n{%- set sectionTitle = \"Section Title\" -%}\n\n<h2 class=\"{% classnames\n    \"block__element\",\n    \"block__element--primary\" if primary,\n    \"block__element--\" + color if color\n%}\">\n    {{ sectionTitle }}\n</h2>\n```\n\nwhich would return:\n\n```html\n<h2 class=\"block__element block__element--turquoise\">\n    Section Title\n</h2>\n```\n","readmeFilename":"README.md"}