{"id":13493702,"url":"https://github.com/gregives/eleventy-critical-css","last_synced_at":"2025-10-29T12:31:44.981Z","repository":{"id":52351788,"uuid":"315462317","full_name":"gregives/eleventy-critical-css","owner":"gregives","description":"An Eleventy plugin to extract and inline critical CSS from your HTML templates","archived":false,"fork":false,"pushed_at":"2023-10-18T17:32:08.000Z","size":705,"stargazers_count":48,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T01:31:57.727Z","etag":null,"topics":["critical","css","eleventy","eleventy-plugin","optimization"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eleventy-critical-css","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregives.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-11-23T23:05:41.000Z","updated_at":"2024-08-14T23:53:40.000Z","dependencies_parsed_at":"2022-09-19T02:32:56.261Z","dependency_job_id":"78d4c7c7-17c5-449b-80e2-0ee59816cc8e","html_url":"https://github.com/gregives/eleventy-critical-css","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":0.07499999999999996,"last_synced_commit":"f9fc4504ef47a4f70f3fd07e31deb536dc133bbb"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-critical-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-critical-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-critical-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregives%2Feleventy-critical-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregives","download_url":"https://codeload.github.com/gregives/eleventy-critical-css/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238825755,"owners_count":19537119,"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":["critical","css","eleventy","eleventy-plugin","optimization"],"created_at":"2024-07-31T19:01:17.944Z","updated_at":"2025-10-29T12:31:39.694Z","avatar_url":"https://github.com/gregives.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# eleventy-critical-css\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n[![Prettier][prettier-src]][prettier-href]\n\nEleventy plugin to extract and inline critical (above-the-fold) CSS from your HTML templates.\n\nYou can easily add this plugin to your Eleventy project **in just two steps** or you can use `index.js` as a reference for your own implementation of critical CSS!\n\n## Get Started\n\n1. Install `eleventy-critical-css`\n\n```sh\nnpm install eleventy-critical-css --save\n```\n\n2. Add the plugin to your Eleventy configuration in `.eleventy.js`\n\n```js\nconst criticalCss = require(\"eleventy-critical-css\");\n\nmodule.exports = function (eleventyConfig) {\n  eleventyConfig.addPlugin(criticalCss);\n};\n```\n\n## Configuration\n\nThis plugin uses [Critical by Addy Osmani](https://github.com/addyosmani/critical) to extract and inline critical from HTML templates i.e. any template with an output path ending in `.html`.\n\nYou can pass options to Critical as a second parameter of `addPlugin`:\n\n```js\nconst criticalCss = require(\"eleventy-critical-css\");\n\nmodule.exports = function (eleventyConfig) {\n  eleventyConfig.addPlugin(criticalCss, {\n    height: 1080,\n    width: 1920,\n  });\n};\n```\n\nYou can see all options for Critical in the [GitHub repository](https://github.com/addyosmani/critical#usage).\n\n### Default Options\n\nThe default options passed to Critical are:\n\n```js\n{\n  assetPaths: [path.dirname(outputPath)],\n  base: outputDir,\n  html: content,\n  inline: true,\n  rebase: ({ originalUrl }) =\u003e originalUrl,\n}\n```\n\nWhere `content` and `outputPath` are the arguments passed to [Eleventy transforms](https://www.11ty.dev/docs/config/#transforms) and `outputDir` is the output directory specified in your [Eleventy configuration](https://www.11ty.dev/docs/config/#output-directory).\n\n### Maximum Concurrency\n\nNode.js will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks.\n\nSo that you don't see warnings when using eleventy-critical-css, the plugin respects the maximum number of listeners. You can use `process.setMaxListeners()` to increase the concurrency of eleventy-critical-css above the default, but be aware that it may be harder to detect memory leaks in your application as a result.\n\n```js\nconst criticalCss = require(\"eleventy-critical-css\");\n\n// Increase concurrency to 100\nprocess.setMaxListeners(100);\n\n// Unlimited concurrency\nprocess.setMaxListeners(0);\n\nmodule.exports = function (eleventyConfig) {\n  eleventyConfig.addPlugin(criticalCss);\n};\n```\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/eleventy-critical-css/latest.svg\n[npm-version-href]: https://npmjs.com/package/eleventy-critical-css\n[npm-downloads-src]: https://img.shields.io/npm/dt/eleventy-critical-css.svg\n[npm-downloads-href]: https://npmjs.com/package/eleventy-critical-css\n[license-src]: https://img.shields.io/npm/l/eleventy-critical-css.svg\n[license-href]: https://npmjs.com/package/eleventy-critical-css\n[prettier-src]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg\n[prettier-href]: https://github.com/prettier/prettier\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregives%2Feleventy-critical-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregives%2Feleventy-critical-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregives%2Feleventy-critical-css/lists"}