{"id":15163058,"url":"https://github.com/ashur/eleventy-plugin-styles","last_synced_at":"2026-01-31T06:03:57.134Z","repository":{"id":93613517,"uuid":"607990354","full_name":"ashur/eleventy-plugin-styles","owner":"ashur","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-23T20:46:30.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-09T00:39:10.572Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-01T04:43:51.000Z","updated_at":"2023-03-01T04:56:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe4cbe88-042a-4ab9-b19d-b7f95418af75","html_url":"https://github.com/ashur/eleventy-plugin-styles","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"349e21c32392bd411ea7b05515c9284a1d282c89"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ashur/eleventy-plugin-styles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashur%2Feleventy-plugin-styles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashur%2Feleventy-plugin-styles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashur%2Feleventy-plugin-styles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashur%2Feleventy-plugin-styles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashur","download_url":"https://codeload.github.com/ashur/eleventy-plugin-styles/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashur%2Feleventy-plugin-styles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28931085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T04:05:25.756Z","status":"ssl_error","status_checked_at":"2026-01-31T04:02:35.005Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-27T02:02:50.925Z","updated_at":"2026-01-31T06:03:57.088Z","avatar_url":"https://github.com/ashur.png","language":"JavaScript","readme":"# eleventy-plugin-styles\n\nAn [Eleventy](https://11ty.dev/) plugin — available as a filter and a shortcode — for joining truthy object values into a semicolon-delimited string, suitable for use in an HTML element's `style` attribute:\n\n```javascript\nstyles({\n    \"background-color\": backgroundColor,\n    \"--custom-property\": customProperty,\n    \"--falsy-variable\": falsyVar \u0026\u0026 \"green\",\n})\n// returns \"background-color: red; --custom-property: 10px\"\n```\n\n## Setup\n\nRun the following command at the root of your Eleventy project:\n\n```shell\nnpm install @aaashur/eleventy-plugin-styles\n```\n\nthen include it in your `.eleventy.js` config file:\n\n```javascript\nconst styles = require(\"@aaashur/eleventy-plugin-styles\");\n\nmodule.exports = (eleventyConfig) =\u003e {\n    eleventyConfig.addPlugin(styles);\n};\n```\n\n## Usage\n\n`styles` 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\u003e ✨ 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---\nbackgroundColor: red\ncustomProperty: 10px\nsectionTitle: Section Title\n---\n\u003ch2 :style=\"styles({\n\t    'background-color': backgroundColor,\n\t    '--custom-property': customProperty,\n\t    '--undefined-var': undefinedVar \u0026\u0026 'green',\n\t})\"\n\t@text=\"sectionTitle\"\n\u003e\u003c/h2\u003e\n```\n\nwhich would return:\n\n```html\n\u003ch2 style=\"background-color: red; --custom-property: 10px\"\u003e\n    Section Title\n\u003c/h2\u003e\n```\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 backgroundColor = \"red\" %}\n{% set customProperty = \"10px\" %}\n{% set sectionTitle = \"Section Title\" %}\n\n\u003ch2 style=\"{% styles {\n    \"background-color\": backgroundColor,\n    \"--custom-property\": customProperty,\n    \"--undefined-var\": \"green\" if undefinedVar\n} %}\"\u003e\n    {{ sectionTitle }}\n\u003c/h2\u003e\n```\n\nwhich would return:\n\n```html\n\u003ch2 style=\"background-color: red; --custom-property: 10px\"\u003e\n    Section Title\n\u003c/h2\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashur%2Feleventy-plugin-styles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashur%2Feleventy-plugin-styles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashur%2Feleventy-plugin-styles/lists"}