{"id":13417313,"url":"https://github.com/nystudio107/rollup-plugin-critical","last_synced_at":"2025-04-12T18:49:15.530Z","repository":{"id":38687573,"uuid":"372101788","full_name":"nystudio107/rollup-plugin-critical","owner":"nystudio107","description":"Vite.js \u0026 Rollup plugin for generating critical CSS","archived":false,"fork":false,"pushed_at":"2025-02-02T19:53:49.000Z","size":571,"stargazers_count":107,"open_issues_count":2,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T22:11:10.905Z","etag":null,"topics":["critical","critical-css","rollup","rollup-plugin","vite","vitejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/nystudio107.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-05-30T01:42:33.000Z","updated_at":"2025-03-19T21:35:01.000Z","dependencies_parsed_at":"2023-11-22T19:27:48.638Z","dependency_job_id":"0a536106-c9b0-4314-8bf6-69c582413c34","html_url":"https://github.com/nystudio107/rollup-plugin-critical","commit_stats":{"total_commits":115,"total_committers":4,"mean_commits":28.75,"dds":"0.26086956521739135","last_synced_commit":"e6ba657291def5e14a778d2cf5e691b0dd8cd40e"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Frollup-plugin-critical","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Frollup-plugin-critical/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Frollup-plugin-critical/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Frollup-plugin-critical/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nystudio107","download_url":"https://codeload.github.com/nystudio107/rollup-plugin-critical/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618218,"owners_count":21134199,"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","critical-css","rollup","rollup-plugin","vite","vitejs"],"created_at":"2024-07-30T22:00:35.221Z","updated_at":"2025-04-12T18:49:15.500Z","avatar_url":"https://github.com/nystudio107.png","language":"TypeScript","funding_links":[],"categories":["Plugins","TypeScript"],"sub_categories":["Framework-agnostic Plugins"],"readme":"![Build](https://github.com/nystudio107/rollup-plugin-critical/actions/workflows/node.js.yml/badge.svg)\n![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/khalwat/550f6ee414a26e0c8eae7cb6af3c214e/raw/rollup-plugin-critical__heads_master.json)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nystudio107/rollup-plugin-critical/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nystudio107/rollup-plugin-critical/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/nystudio107/rollup-plugin-critical/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/nystudio107/rollup-plugin-critical/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/nystudio107/rollup-plugin-critical/badges/build.png?b=master)](https://scrutinizer-ci.com/g/nystudio107/rollup-plugin-critical/build-status/master)\n\n# rollup-plugin-critical\n\n[Vite.js](https://vitejs.dev/) \u0026 [Rollup](https://rollupjs.org/) plugin for generating critical CSS that uses the [critical](https://github.com/addyosmani/critical) generator under the hood.\n\n## Install\n\n```bash\nnpm i -D rollup-plugin-critical\n```\n\n## Usage\n\n```js\n// rollup.config.js\n\nimport PluginCritical from 'rollup-plugin-critical';\n\nexport default {\n  input: 'index.js',\n  output: {\n    dir: 'dist',\n    format: 'es',\n  },\n  plugins: [\n    PluginCritical({\n        criticalUrl: 'https://nystudio107.com/',\n        criticalBase: './',\n        criticalPages: [\n            { uri: '', template: 'index' },\n            { uri: 'about', template: 'about/index' },\n        ],\n        criticalConfig: {\n        },\n    }),\n  ],\n}\n```\n\n## Options\n\n### `criticalUrl: string`\n\nThe base URL to use in combination with the `criticalPages` `uri`s to determine the URLs to scrape for Critical CSS.\n\nThis can also be a file system path. This is combined with `criticalPages.uri` (see below) to determine pages to scrap for critical CSS.\n\nDetermines the `criticalConfig.src` property (see below)\n\n### `criticalBase: string`\n\nThe base file system path to where the generated Critical CSS file should be saved.\n\nThis is combined with `criticalPages.template` (see below) with `_critical.min.css` appended to it to determine the saved critical CSS file name.\n\nDetermines the `criticalConfig.target` property (see below)\n\n### `criticalPages: array of objects`\n\nAn array objects that contain the page `uri`s that are combined with the `criticalUrl` to determine the URLs to scrape for Critical CSS.\n\nThe resulting files are named with the `template` path, and saved to the `criticalBase` directory\n\n### `criticalConfig: object`\n\nThis is the full [config for critical](https://github.com/addyosmani/critical#options) that is passed through to the `critical` package.\n\nYou may optionally override any properties you like here. The default values passed in are:\n\n```ts\nconst defaultCriticalConfig: Partial\u003cCriticalConfig\u003e = {\n    inline: false,\n    extract: false,\n    width: 1200,\n    height: 1200,\n    penthouse: {\n        blockJSRequests: false\n    }\n};\n```\n\nThe following [critical config properties](https://github.com/addyosmani/critical#options) are set dynamically by `rollup-plugin-critical`, but can be overridden via `criticalConfig`:\n\n- **`css`** - set to the css files that are generated in the Rollup build\n- **`base`** - property is set to `criticalBase`\n- **`src`** - derived from `criticalUrl` and `criticalPages.uri`\n- **`target`** - derived from `criticalPages.template` with `_critical.min.css` appended to it. If the `inline` option is set to `true`, the suffix `.html` is appended instead.\n## License\n\n[MIT](LICENSE) © [nystudio107](https://nystudio107.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnystudio107%2Frollup-plugin-critical","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnystudio107%2Frollup-plugin-critical","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnystudio107%2Frollup-plugin-critical/lists"}