{"id":13396882,"url":"https://github.com/ehynds/grunt-image-embed","last_synced_at":"2025-04-06T20:12:14.459Z","repository":{"id":4638855,"uuid":"5783647","full_name":"ehynds/grunt-image-embed","owner":"ehynds","description":"A grunt task for converting images inside a stylesheet to base64-encoded data URI strings.","archived":false,"fork":false,"pushed_at":"2021-09-02T09:11:18.000Z","size":523,"stargazers_count":112,"open_issues_count":16,"forks_count":55,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2024-09-19T00:28:34.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ehynds.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2012-09-12T17:51:22.000Z","updated_at":"2024-06-01T10:20:07.000Z","dependencies_parsed_at":"2022-09-26T16:21:11.078Z","dependency_job_id":null,"html_url":"https://github.com/ehynds/grunt-image-embed","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehynds%2Fgrunt-image-embed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehynds%2Fgrunt-image-embed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehynds%2Fgrunt-image-embed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehynds%2Fgrunt-image-embed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehynds","download_url":"https://codeload.github.com/ehynds/grunt-image-embed/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543593,"owners_count":20955865,"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-07-30T18:01:05.927Z","updated_at":"2025-04-06T20:12:14.429Z","avatar_url":"https://github.com/ehynds.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Grunt Image Embed\n\nThis task converts all data found within a stylesheet (those within a url( ... ) declaration) into base64-encoded data URI strings. This includes images and fonts.\n\nCreated by Eric Hynds [@erichynds](http://twitter.com/erichynds) with major contributions from [dancingplatypus](https://github.com/dancingplatypus).\n\n## Features\n\n* Supports both local \u0026 remote images.\n* Ability to specify a size limit. Default is 32kb which is IE8's limit.\n* Existing data URIs will be ignored.\n* Skip specific images by specifying a directive comment.\n* Ability to purge images that have been encoded\n* Includes two helpers: `encode_stylesheet` to encode a stylesheet, and `encode_image` to encode an image.\n\n## Getting Started\n\nInstall this plugin with the command:\n\n```js\nnpm install grunt-image-embed\n```\n\nNext, add this line to your project's grunt file:\n\n```js\ngrunt.loadNpmTasks(\"grunt-image-embed\");\n```\n\nLastly, add configuration settings to your grunt.js file (see below).\n\n## Documentation\n\nThis task has two required properties, `src` and `dest`. `src` is the path to your stylesheet and `dest` is the file this task will write to (relative to the grunt.js file). If this file already exists **it will be overwritten**.\n\nAn example configuration looks like this:\n\n```js\ngrunt.initConfig({\n  imageEmbed: {\n    dist: {\n      src: [ \"css/styles.css\" ],\n      dest: \"css/output.css\",\n      options: {\n        deleteAfterEncoding : false,\n        preEncodeCallback: function (filename) { return true; }\n      }\n    }\n  }\n});\n```\n\n### Optional Configuration Properties\n\nImageEmbed can be customized by specifying the following options:\n\n* `maxImageSize`: The maximum size of the base64 string in bytes. This defaults to `32768`, or IE8's limit. Set this to `0` to remove the limit and allow any size string.\n\n* `baseDir`: If you have absolute image paths in your stylesheet, the path specified in this option will be used as the base directory.\n\n* `deleteAfterEncoding`: Set this to true to delete images after they've been encoded. You'll want to do this in a staging area, and not in your source directories.  Be careful.\n\n* `preEncodeCallback`: function that takes full path to the image to be encoded and returns either `true` (proceeed with default encoding), `false` (abort the encoding, fail with error) or String, which will be used as the result of the encoding.\n\n* `regexInclude` - Regular expression testing against file types to include. Defaults to all (`/.*/g`). To only include images, you might set this to `/\\.(jpg|png|gif|jpeg)/gi`.\n\n* `regexExclude` - Regular expression testing against file types to exclude. Defaults to none (``/$^/g`). To exclude fonts for example, you might set this to `/\\.(eot|woff|ttf|svg)/gi`.\n\n### Skipping Images\n\nSpecify that an image should be skipped by adding the following comment directive *after* the image:\n\n```css\nbackground: url(image.gif); /*ImageEmbed:skip*/\n```\n\n## Compatibility\n\nVersion \u003e= 0.3.0 of this plugin is compatible with Grunt 0.4.x. Versions 0.0.1 through 0.2.0 are only compatible with Grunt 0.3.x.\n\n## License\n\nCopyright (c) 2013 Eric Hynds (@erichynds)\nLicensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehynds%2Fgrunt-image-embed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehynds%2Fgrunt-image-embed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehynds%2Fgrunt-image-embed/lists"}