{"id":18254999,"url":"https://github.com/saperio/grunt-image-size","last_synced_at":"2025-04-04T17:31:00.839Z","repository":{"id":15758787,"uuid":"18497567","full_name":"saperio/grunt-image-size","owner":"saperio","description":"grunt plugin for retrieve image size information","archived":false,"fork":false,"pushed_at":"2018-01-09T23:12:58.000Z","size":39,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-07T18:48:55.277Z","etag":null,"topics":["grunt-plugins","image-size","javascript"],"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/saperio.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":"2014-04-06T19:37:08.000Z","updated_at":"2018-01-09T13:53:33.000Z","dependencies_parsed_at":"2022-09-26T20:31:22.729Z","dependency_job_id":null,"html_url":"https://github.com/saperio/grunt-image-size","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saperio%2Fgrunt-image-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saperio%2Fgrunt-image-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saperio%2Fgrunt-image-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saperio%2Fgrunt-image-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saperio","download_url":"https://codeload.github.com/saperio/grunt-image-size/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223150704,"owners_count":17095959,"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":["grunt-plugins","image-size","javascript"],"created_at":"2024-11-05T10:14:19.561Z","updated_at":"2024-11-05T10:14:20.489Z","avatar_url":"https://github.com/saperio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-image-size\n\nRetrieve image size information. The [image-size](https://github.com/image-size/image-size) port for grunt. \n\n## Getting Started\n\nThis plugin requires Grunt.\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-image-size --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-image-size');\n```\n\n## The \"image_size\" task\n\n### Overview\n\nThis task produces a vector of an image size data from all provided source files:\n\n```js\n[\n  {\n    name : 'path/to/file'\n    width : 100,\n    height : 100\n  },\n  ...\n]\n```\n\nAnd outputs it to grunt Config Data and/or to dest file (as json).\n\n### Options\n\n#### options.configObject\n\nType: `String` Default: `undefined`\n\nA string value that is used as a name for grunt config object for outputing data.\n\n#### options.processName\n\nType: `Function` Default: `undefined`\n\nAllows to alter name (file path) of each `src`.\n\nWill be invoked with injected values for following arguments:\n\n* `src` — current `src`;\n* `file` — `file` of current `src`.\n\n`this` will correspond to the current `file` of the task.\n\nShould return a `String`.\n\n#### options.processEntry\n\nType: `Function` Default: `undefined`\n\nAllows to alter formed data of each `src`.\n\nWill be invoked with injected values for following arguments:\n\n* `entry` — original `src` data;\n* `src` — file path of current `src`;\n* `file` — `file` of current `src`.\n\n`this` will correspond to the current `file`.\n\nShould return an `Object`.\n\n#### options.processSizes\n\nType: `Function` Default: `undefined`\n\nAllows to alter final data.\n\nResult of this function will be used for printing Object to `dest` file.\n\nWill be invoked with injected values for following arguments:\n\n* `sizes` — extracted and optionally processed final data;\n* `file` — current `file` instance.\n\n`this` will correspond to the current `file` of the task.\n\nShould return whatever you want to print as a result.\n\n#### options.replacer\n\nType: `Function|String[]|Number[]` Default: `null`\n\nPass [replacer](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) parameter to `JSON.stringify()`.\n\n#### options.space\n\nType: `String|Integer` Default: `2`\n\nPass [space](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) parameter to `JSON.stringify()`.\n\nControls indentation for outputted JSON file.\n\n### Usage Examples\n\nAfter processing all images from `img/` script writes size information to `image_data` config object and image_data.json file.\n\n```js\ngrunt.initConfig({\n  image_size: {\n    options: {\n      configObject : 'image_data'\n    },\n    files: [{\n      src : 'img/*',\n      dest : 'image_data.json'\n    }]\n  }\n})\n```\n\nFrom `image_data` it can be accessed with `grunt.config.get('image_data')` or via template `\u003c%= image_data %\u003e`\n\n### Development and testing\n\nPlease, lint and test the code with `npm test` before posting PRs.\n\nGot some lint errors? Run `npm run format`.\n\nTests failing? Fix the code to make them pass. Use `npm run test:watch` for easier workflow.\n\n## License\n\nCopyright (c) 2014 SAPer. Licensed under the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaperio%2Fgrunt-image-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaperio%2Fgrunt-image-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaperio%2Fgrunt-image-size/lists"}