{"id":24983680,"url":"https://github.com/posthtml/posthtml-noscript","last_synced_at":"2025-03-29T10:12:38.499Z","repository":{"id":43979478,"uuid":"202820366","full_name":"posthtml/posthtml-noscript","owner":"posthtml","description":"PostHTML plugin to insert noscript content","archived":false,"fork":false,"pushed_at":"2023-06-06T02:34:29.000Z","size":293,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T21:06:06.680Z","etag":null,"topics":["noscript","posthtml","posthtml-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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":"2019-08-17T01:22:15.000Z","updated_at":"2022-02-13T03:45:32.000Z","dependencies_parsed_at":"2022-09-07T07:42:32.743Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-noscript","commit_stats":{"total_commits":77,"total_committers":3,"mean_commits":"25.666666666666668","dds":0.5064935064935066,"last_synced_commit":"ff80aeade7b4e3859aacf012cb52236a1db52fd9"},"previous_names":["metonym/posthtml-noscript"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-noscript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245467620,"owners_count":20620215,"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":["noscript","posthtml","posthtml-plugin"],"created_at":"2025-02-04T09:20:16.524Z","updated_at":"2025-03-29T10:12:38.481Z","avatar_url":"https://github.com/posthtml.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# posthtml-noscript \u003cimg align=\"right\" width=\"220\" height=\"200\" title=\"PostHTML logo\" src=\"http://posthtml.github.io/posthtml/logo.svg\"\u003e\n\n[![NPM][npm]][npm-url]\n\n`posthtml-noscript` is a [PostHTML](https://github.com/posthtml/posthtml) plugin to insert [noscript](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript) content.\n\n**Use Cases:**\n\n- Display an \"Enable JavaScript\" message in a Single Page Application (SPA)\n- Specify resourcs (e.g. StyleSheets) to load if JavaScript is disabled\n\n---\n\n**Before:**\n\n```html\n\u003cbody\u003e\n  \u003cdiv id=\"root\"\u003e\u003c/div\u003e\n\u003c/body\u003e\n```\n\n**After:**\n\n```html\n\u003cbody\u003e\n  \u003cnoscript\u003eYou need to enable JavaScript to run this app.\u003c/noscript\u003e\n  \u003cdiv id=\"root\"\u003e\u003c/div\u003e\n\u003c/body\u003e\n```\n\n## Installation\n\n```bash\n# Yarn\nyarn add -D posthtml-noscript\n\n# NPM\nnpm i -D posthtml-noscript\n\n# pnpm\npnpm i -D posthtml-noscript\n```\n\n## Usage\n\n```js\nconst fs = require(\"fs\");\nconst posthtml = require(\"posthtml\");\nconst { noscript } = require(\"posthtml-noscript\");\n\nconst html = fs.readFileSync(\"./index.html\");\n\nposthtml()\n  .use(\n    noscript({\n      content: \"You need to enable JavaScript to run this app.\",\n    })\n  )\n  .process(html)\n  .then((result) =\u003e fs.writeFileSync(\"./after.html\", result.html));\n```\n\n## Options\n\nBy default, the plugin prepends noscript markup inside the body tag.\n\nOptionally, specify \"head\" as the parent tag to insert noscript content inside the head tag.\n\n**Before:**\n\nIn this example, custom fonts are loaded via [Adobe Typekit](https://fonts.adobe.com/) using JavaScript. Without a resource link fallback, custom fonts can't be loaded.\n\n```html\n\u003chead\u003e\n  \u003cscript src=\"https://use.typekit.net/XYZ.js\"\u003e\n    try { Typekit.load({ async: true }); } catch(e) {}\n  \u003c/script\u003e\n\u003c/head\u003e\n```\n\n**Config:**\n\n```js\nconst fs = require(\"fs\");\nconst posthtml = require(\"posthtml\");\nconst { noscript } = require(\"posthtml-noscript\");\n\nconst html = fs.readFileSync(\"./index.html\");\n\nposthtml()\n  .use(\n    noscript({\n      content: '\u003clink rel=\"stylesheet\" href=\"fonts.css\" /\u003e',\n      parent: \"head\",\n    })\n  )\n  .process(html)\n  .then((result) =\u003e fs.writeFileSync(\"./after.html\", result.html));\n```\n\n**After:**\n\nIf JavaScript is disabled, custom fonts can still be loaded.\n\n```html\n\u003chead\u003e\n  \u003cnoscript\u003e\u003clink rel=\"stylesheet\" href=\"fonts.css\" /\u003e\u003c/noscript\u003e\n  \u003cscript src=\"https://use.typekit.net/XYZ.js\"\u003e\n    try { Typekit.load({ async: true }); } catch(e) {}\n  \u003c/script\u003e\n\u003c/head\u003e\n```\n\n## Contributing\n\nSee the [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs).\n\n## [Changelog](CHANGELOG.md)\n\n## License\n\n[MIT](LICENSE)\n\n[npm]: https://img.shields.io/npm/v/posthtml-noscript.svg?color=blue\n[npm-url]: https://npmjs.com/package/posthtml-noscript\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-noscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-noscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-noscript/lists"}