{"id":19721099,"url":"https://github.com/paramsiddharth/imaginator","last_synced_at":"2025-02-27T18:23:52.374Z","repository":{"id":57272386,"uuid":"300476743","full_name":"paramsiddharth/imaginator","owner":"paramsiddharth","description":"Converts each image tag to use data URIs in an HTML document.","archived":false,"fork":false,"pushed_at":"2020-10-06T04:06:50.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-22T20:20:59.728Z","etag":null,"topics":[],"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/paramsiddharth.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":"2020-10-02T02:07:28.000Z","updated_at":"2020-10-06T04:06:52.000Z","dependencies_parsed_at":"2022-09-15T10:52:48.478Z","dependency_job_id":null,"html_url":"https://github.com/paramsiddharth/imaginator","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/paramsiddharth%2Fimaginator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramsiddharth%2Fimaginator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramsiddharth%2Fimaginator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramsiddharth%2Fimaginator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paramsiddharth","download_url":"https://codeload.github.com/paramsiddharth/imaginator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240250449,"owners_count":19771794,"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-11T23:13:21.291Z","updated_at":"2025-02-27T18:23:52.356Z","avatar_url":"https://github.com/paramsiddharth.png","language":"JavaScript","readme":"# Imaginator\r\nAn Express middleware that converts image tags to use data URIs instead of image files an HTML document.\r\n\r\n## Installation\r\n```\r\n\u003e npm install --save imaginator\r\n```\r\n\r\n## Usage\r\n``` javascript\r\nconst express = require('express');\r\nconst path = require('path');\r\nconst imaginator = require('imaginator');\r\n\r\nconst app = express();\r\n\r\napp.use(imaginator(path.join(__dirname, 'public'), 'img.datauri'));\r\napp.use(express.static(path.join(__dirname, 'public')));\r\n\r\napp.listen(3000);\r\n```\r\n\r\n**`imaginator(publicDirectory, selector = 'img')`**\r\n\r\n- `publicDirectory` : The path to the directory where the hosted public files (including the images) are stored. In most cases, it should be set to `path.join(__dirname, 'public')`.\r\n - _`selector`_ : The CSS-style selector for the tags to be affected. Its default value is `'img'` i. e. All `img` tags will be affected.\r\n\r\n## Example\r\n\r\n`index.html` before applying Imaginator:\r\n``` html\r\n\u003c!DOCTYPE html\u003e\r\n\u003chtml\u003e\r\n\t\u003chead\u003e\r\n\t\t\u003ctitle\u003eHi\u003c/title\u003e\r\n\t\u003c/head\u003e\r\n\t\u003cbody\u003e\r\n\t\tHello world! \u003cbr/\u003e\r\n\t\t\u003cimg src='images/image1.png'\u003e\r\n\t\t\u003cimg src='images/image2.png'\u003e\r\n\t\t\u003cimg class='datauri' src='images/image3.png'\u003e\r\n\t\u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n\r\n`index.html` after applying Imaginator:\r\n``` html\r\n\u003c!DOCTYPE html\u003e\r\n\u003chtml\u003e\r\n\t\u003chead\u003e\r\n\t\t\u003ctitle\u003eHi\u003c/title\u003e\r\n\t\u003c/head\u003e\r\n\t\u003cbody\u003e\r\n\t\tHello world! \u003cbr/\u003e\r\n\t\t\u003cimg src='images/image1.png'\u003e\r\n\t\t\u003cimg src='images/image2.png'\u003e\r\n\t\t\u003cimg class='datauri' src='data:image/png;base64,...=='\u003e\r\n\t\u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n\r\nMade with ❤ by [Param](http://www.paramsid.com).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamsiddharth%2Fimaginator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparamsiddharth%2Fimaginator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamsiddharth%2Fimaginator/lists"}