{"id":19218543,"url":"https://github.com/sitespeedio/grunt-sitespeedio","last_synced_at":"2025-05-13T00:17:03.695Z","repository":{"id":26942018,"uuid":"30404635","full_name":"sitespeedio/grunt-sitespeedio","owner":"sitespeedio","description":"Test performance budgets and performance best practice rules using sitespeed.io","archived":false,"fork":false,"pushed_at":"2019-01-27T19:44:35.000Z","size":243,"stargazers_count":27,"open_issues_count":8,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-27T06:36:43.111Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.sitespeed.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sitespeedio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-06T09:21:40.000Z","updated_at":"2024-01-17T09:49:16.000Z","dependencies_parsed_at":"2022-08-31T12:11:58.185Z","dependency_job_id":null,"html_url":"https://github.com/sitespeedio/grunt-sitespeedio","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitespeedio%2Fgrunt-sitespeedio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitespeedio%2Fgrunt-sitespeedio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitespeedio%2Fgrunt-sitespeedio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitespeedio%2Fgrunt-sitespeedio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sitespeedio","download_url":"https://codeload.github.com/sitespeedio/grunt-sitespeedio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252794991,"owners_count":21805290,"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-11-09T14:27:12.397Z","updated_at":"2025-05-13T00:17:03.671Z","avatar_url":"https://github.com/sitespeedio.png","language":"JavaScript","readme":"# grunt-sitespeedio\n\n## Test your website using sitespeed.io\n\ngrunt-sitespeedio is a [Grunt.js](https://github.com/cowboy/grunt/) task for testing your site against web performance best practice rules, fetch timings from a browser, test and enforce [performance budgets](#performance-budget), send performance metrics to [Graphite](http://graphite.wikidot.com/) using [sitespeed.io](https://www.sitespeed.io).\n\nCheck out the [documentation](https://www.sitespeed.io/documentation/) to get a full overview of what you can do and test using [sitespeed.io](https://www.sitespeed.io).\n\n## Getting Started\nThis plugin requires Grunt `~0.4.5`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-sitespeedio --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-sitespeedio');\n```\n\n## The sitespeedio task\n\n### Required configuration properties\n\nTo start testing pages, you must configure a URL for your crawl.\n\n```javascript\nsitespeedio: {\n  default: {\n    options: {\n      urls: ['https://www.sitespeed.io/']\n    }\n  }\n}\n```\n\n### Testing multiple URLs\n```javascript\nsitespeedio: {\n  default: {\n    options: {\n      urls: ['https://www.sitespeed.io', 'https://www.sitespeed.io/faq/']\n    }\n  }\n}\n```\n\nWith these configuration properties set, you can add `sitespeedio` to your default tasks list. That'll look something like this:\n\n    grunt.registerTask('default', ['jshint', 'sitespeedio']);\n\nWith this in place, grunt-sitespeedio will now collect performance metrics for your site.\n\n## The result files\nThe result files will automatically be stored in a temporary directory. If you want to change that, use\nthe *resultBaseDir* property, like this:\n\n```javascript\nsitespeedio: {\n  default: {\n    options: {\n      urls: ['https://www.sitespeed.io'],\n      outputFolder: '/my/new/dir/'\n    }\n  }\n}\n```\n\n## Use cases\nFetch timings, sending performance metrics to Graphite and performance budgets.\n\n### Fetching timing metrics\n\nYou can choose to collect Navigation Timing and User Timing metrics using real browser. You can choose by using Firefox or Chrome. And you can configure the connection speed ([more info](http://www.sitespeed.io/documentation/#connectionspeed) by choosing between mobile3g, mobile3gfast, cable and native. And choose how many times you want to test each URL (default is 3).\n\nYou surely want to combine it with running [Xvfb](https://gist.github.com/nwinkler/f0928740e7ae0e7477dd) to avoid opening the browser.\n\n```javascript\nsitespeedio: {\n  default: {\n    options: {\n      urls: ['https://www.sitespeed.io', 'https://www.sitespeed.io/faq/'],\n      browsertime: {\n        browser: 'firefox',\n        connectivity: 'native',\n        iterations: 5\n      }\n    }\n  }\n}\n```\n\n### Performance Budget\nTest your site against a [performance budget](http://timkadlec.com/2013/01/setting-a-performance-budget/). You can test your site against almost all data collected by sitespeed.io.\n\nCheckout the [example Gruntfile]() and budget looks something like this:\n\n```\nbudget: {\n  config: {\n    \"browsertime.pageSummary\": [{\n      metric: \"statistics.timings.firstPaint.median\",\n      \"max\": 1000\n    }, {\n      \"metric\": \"statistics.visualMetrics.FirstVisualChange.median\",\n      \"max\": 1000\n    }],\n    \"coach.pageSummary\": [{\n      \"metric\": \"advice.performance.score\",\n      \"min\": 75\n    }, {\n      \"metric\": \"advice.info.domElements\",\n      \"max\": 200\n    }, {\n      \"metric\": \"advice.info.domDepth.max\",\n      \"max\": 10\n    }, {\n      \"metric\": \"advice.info.iframes\",\n      \"max\": 0\n    }, {\n      \"metric\": \"advice.info.pageCookies.max\",\n      \"max\": 5\n    }],\n    \"pagexray.pageSummary\": [{\n      \"metric\": \"transferSize\",\n      \"max\": 100000\n    }, {\n      \"metric\": \"requests\",\n      \"max\": 20\n    }, {\n      \"metric\": \"missingCompression\",\n      \"max\": 0\n    }, {\n      \"metric\": \"contentTypes.css.requests\",\n      \"max\": 1\n    }, {\n      \"metric\": \"contentTypes.image.transferSize\",\n      \"max\": 100000\n    }, {\n      \"metric\": \"documentRedirects\",\n      \"max\": 0\n    }]\n  }\n}\n```\n\nIf you want to include/exclude tests in the output, you can switch that by a Grunt config like:\n\n```\ngrunt.config.set('includePassed', true);\n```\n\n### Can't find the configuration\n\nsitespeed.io is highly configurable. The grunt-sitespeedio plugin will pass every option to sitespeed, you can see each and every configuration [here](). Each option needs to be called with full name (meaning the same as using **--** for the cli. Say for example that don't need the screenshot for each. Using the cli, you add the flag \u003ccode\u003e--browsertime.screenshot false\u003c/code\u003e\n\nDoing the same with the grunt plugin:\n```javascript\nsitespeedio: {\n  default: {\n    options: {\n      urls: ['http://www.sitespeed.io'],\n      browsertime: {\n        screenshot: false\n      }\n    }\n  }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsitespeedio%2Fgrunt-sitespeedio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsitespeedio%2Fgrunt-sitespeedio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsitespeedio%2Fgrunt-sitespeedio/lists"}