{"id":24983709,"url":"https://github.com/posthtml/posthtml-cache","last_synced_at":"2025-04-11T20:52:22.835Z","repository":{"id":27429149,"uuid":"113581676","full_name":"posthtml/posthtml-cache","owner":"posthtml","description":"Add a nanoid to links in you tags","archived":false,"fork":false,"pushed_at":"2023-03-04T02:30:19.000Z","size":2880,"stargazers_count":11,"open_issues_count":8,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T20:52:18.871Z","etag":null,"topics":["cache","html","link","nanoid","posthtml","posthtml-cache"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/posthtml.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,"governance":null}},"created_at":"2017-12-08T14:15:09.000Z","updated_at":"2022-01-23T18:54:01.000Z","dependencies_parsed_at":"2023-01-14T06:43:43.714Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-cache","commit_stats":{"total_commits":81,"total_committers":5,"mean_commits":16.2,"dds":0.5432098765432098,"last_synced_commit":"52a9141d0da8e626e8d4ebbc77250fab7f0f57d6"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480515,"owners_count":21110936,"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":["cache","html","link","nanoid","posthtml","posthtml-cache"],"created_at":"2025-02-04T09:20:34.102Z","updated_at":"2025-04-11T20:52:22.805Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"# posthtml-cache\n\n\u003e A posthtml plugin for add nanoid to style \u0026 script links and you tags...\n\n[![Travis Build Status](https://img.shields.io/travis/posthtml/posthtml-cache.svg?style=flat-square\u0026label=unix)](https://travis-ci.org/posthtml/posthtml-cache)[![node](https://img.shields.io/node/v/posthtml-cache.svg?style=flat-square)]()[![npm version](https://img.shields.io/npm/v/posthtml-cache.svg?style=flat-square)](https://www.npmjs.com/package/posthtml-cache)[![Dependency Status](https://david-dm.org/posthtml/posthtml-cache.svg?style=flat-square)](https://david-dm.org/posthtml/posthtml-cache)[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/sindresorhus/xo)[![Coveralls status](https://img.shields.io/coveralls/posthtml/posthtml-cache.svg?style=flat-square)](https://coveralls.io/r/posthtml/posthtml-cache)\n\n## Why?\n\n## Install\n\n```bash\nnpm i -S posthtml posthtml-cache\n```\n\n\u003e **Note:** This project is compatible with node v10+\n\n## Usage\n\n```js\nimport {readFileSync, writeFileSync} from 'fs';\nimport posthtml from 'posthtml';\nimport posthtmlCache from 'posthtml-cache';\n\nconst html = readFileSync('input.html', 'utf8');\n\nposthtml()\n  .use(posthtmlCache(/* options */))\n  .process(html)\n  .then(result =\u003e {\n    writeFileSync('output.html', result.html);\n  });\n\n```\n\n## Example\n\ninput.html\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003clink rel=\"stylesheet\" href=\"style.css\"\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cimg data-src=\"logo.svg\" alt=\"\"\u003e\n    \u003cscript src=\"script.js\"\u003e\u003c/script\u003e\n  \u003c/body\u003e\n\u003chtml\u003e\n```\n\noutput.html\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003clink rel=\"stylesheet\" href=\"style.css?v=4f90d13a42\"\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cimg data-src=\"logo.svg?v=VlLqCweTvn_E1g3XXGMtM\" alt=\"\"\u003e\n    \u003cscript src=\"script.js?v=93ce_Ltuub\"\u003e\u003c/script\u003e\n  \u003c/body\u003e\n\u003chtml\u003e\n```\n\u003e *will be added nanoid to all the file link*\n\n## Options\n\n### `tags`\nType: `Array`\nDefault: `['script', 'link']`\nDescription: *You can also expand the list by adding the tags you need...*\n\n### `attributes`\nType: `Array`\nDefault: `['src', 'href']`\nDescription: *You can also expand the list by adding the attributes you need...*\n\n### `exclude`\nType: `Array`\nDefault: `[]`\nDescription: *You can also exclude the list by adding the tags you need...*\n\n### `onlyInternal`\nType: `Array`\nDefault: `[]`\nDescription: *If you have external URL-s, some won't work if you add nanoid to them. If this list is empty, all external links are modified. Otherwise, only the URL-s starting with items in the array (case insensitive) will be modified. E.g. `['https://github.com/']` will add nanoid to all local links and only to `https://github.com/*`. It won't add nanoid to e.g. `http://github.com` or  `https://fonts.google.com`. For simplicity, a link is considered external if it starts with a protocol (see [is-absolute-url](https://www.npmjs.com/package/is-absolute-url)) or with double slash `//`.*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-cache/lists"}