{"id":13724956,"url":"https://github.com/jsxtools/cqfill","last_synced_at":"2025-05-14T11:22:33.985Z","repository":{"id":46078785,"uuid":"361605093","full_name":"jsxtools/cqfill","owner":"jsxtools","description":"Polyfill for CSS Container Queries","archived":false,"fork":false,"pushed_at":"2021-11-16T01:09:58.000Z","size":49,"stargazers_count":404,"open_issues_count":9,"forks_count":4,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-07T19:43:52.924Z","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/jsxtools.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}},"created_at":"2021-04-26T03:26:31.000Z","updated_at":"2025-01-27T09:15:38.000Z","dependencies_parsed_at":"2022-08-30T21:30:09.009Z","dependency_job_id":null,"html_url":"https://github.com/jsxtools/cqfill","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxtools%2Fcqfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxtools%2Fcqfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxtools%2Fcqfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsxtools%2Fcqfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsxtools","download_url":"https://codeload.github.com/jsxtools/cqfill/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129909,"owners_count":22019691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-08-03T01:02:07.941Z","updated_at":"2025-05-14T11:22:33.938Z","avatar_url":"https://github.com/jsxtools.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# CQFill\n\n**CQFill** is a polyfill for [CSS Container Queries].\n\n```sh\nnpm install cqfill # yarn add cqfill\n```\n\n## Demos\n\n\u003ctable\u003e\u003ctr\u003e\u003ctd\u003e\u003ca href=\"https://codepen.io/jonneal/full/rNjRBOX\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/188426/116027454-ed950f80-a622-11eb-94f5-be5b9307705b.png\" alt=\"Component Query Card Demo\" width=\"340\" /\u003e\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003ctd\u003e\u003ca href=\"https://codepen.io/jonneal/full/WNRPBQg\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/188426/116027093-f76a4300-a621-11eb-9530-e67727e7fd71.png\" alt=\"Article - QC\" width=\"340\" /\u003e\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003ctable\u003e\u003ctr\u003e\u003ctd\u003e\u003ca href=\"https://codepen.io/jonneal/full/YzNBber\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/188426/116027091-f6d1ac80-a621-11eb-9c20-2322c1b2a2c8.png\" alt=\"Balloon G-OPAW\" width=\"340\" /\u003e\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n## Usage\n\nAdd the **CQFill** polyfill to your page:\n\n```html\n\u003cscript src=\"https://unpkg.com/cqfill\"\u003e\u003c/script\u003e\n```\n\nOr, add the CQFill script to your NodeJS project:\n\n```js\nimport 'cqfill'\n```\n\nNext, add the included [PostCSS] plugin to your `.postcssrc.json` file:\n\n```js\n{\n  \"plugins\": [\n    \"cqfill/postcss\"\n  ]\n}\n```\n\nNow, go forth and use CSS container queries:\n\n```css\n.container {\n  contain: layout inline-size;\n}\n\n@container (min-width: 700px) {\n  .contained {\n    /* styles applied when a container is at least 700px */\n  }\n}\n```\n\n## Tips\n\nYou can use [PostCSS Nesting] to nest `@container` rules:\n\n```js\n{\n  \"plugins\": [\n    \"postcss-nesting\",\n    \"cqfill/postcss\"\n  ]\n}\n```\n\nYou can activate the polyfill manually:\n\n```html\n\u003cscript src=\"https://unpkg.com/cqfill/export\"\u003e\u003c/script\u003e\n\n\u003cscript\u003ecqfill() /* cqfill(document); cqfill(shadowRoot) */\u003c/script\u003e\n```\n\n```js\nimport { cqfill } from 'cqfill'\n\ncqfill() /* cqfill(document); cqfill(shadowRoot) */\n```\n\n## Usage with PostCSS\n\nUse the included PostCSS plugin to process your CSS:\n\n```js\nimport postcss from 'postcss'\nimport postcssCQFill from 'cqfill/postcss'\n\npostcss([ postcssCQFill ])\n```\n\nTo transform CSS with PostCSS and without any other tooling:\n\n```js\nimport fs from 'fs'\nimport postcss from 'postcss'\nimport postcssCQFill from 'cqfill/postcss'\n\nconst from = './test/readme.css'\nconst fromCss = fs.readFileSync(from, 'utf8')\n\nconst to = './test/readme.polyfilled.css'\n\npostcss([ postcssCQFill ]).process(fromCss, { from, to }).then(\n  ({ css }) =\u003e fs.writeFileSync(to, css)\n)\n```\n\n## Usage without PostCSS\n\nAdd a fallback property to support the CSS [`contain`] property.\n\n```css\n/* before */\n.container {\n  contain: layout inline-size;\n}\n\n/* after */\n.container {\n  --css-contain: layout inline-size;\n  contain: layout inline-size;\n}\n```\n\nDuplicate container queries using a fallback rule.\n\n```css\n/* before */\n@container (min-width: 700px) {\n  .contained {\n    /* styles applied when a container is at least 700px */\n  }\n}\n\n/* after */\n@media --css-container and (min-width: 700px) {\n  .contained {\n    /* styles applied when a container is at least 700px */\n  }\n}\n\n@container (min-width: 700px) {\n  .contained {\n    /* styles applied when a container is at least 700px */\n  }\n}\n```\n\n[`contain`]: https://developer.mozilla.org/en-US/docs/Web/CSS/contain\n[CSS Container Queries]: https://css.oddbird.net/rwd/query/explainer/\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Nesting]: https://github.com/csstools/postcss-nesting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsxtools%2Fcqfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsxtools%2Fcqfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsxtools%2Fcqfill/lists"}