# posthtml-noscript
**Repository Path**: mirrors_posthtml/posthtml-noscript
## Basic Information
- **Project Name**: posthtml-noscript
- **Description**: PostHTML plugin to insert noscript content
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-25
- **Last Updated**: 2025-09-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# posthtml-noscript
[![NPM][npm]][npm-url]
`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.
**Use Cases:**
- Display an "Enable JavaScript" message in a Single Page Application (SPA)
- Specify resourcs (e.g. StyleSheets) to load if JavaScript is disabled
---
**Before:**
```html
```
**After:**
```html
```
## Installation
```bash
# Yarn
yarn add -D posthtml-noscript
# NPM
npm i -D posthtml-noscript
# pnpm
pnpm i -D posthtml-noscript
```
## Usage
```js
const fs = require("fs");
const posthtml = require("posthtml");
const { noscript } = require("posthtml-noscript");
const html = fs.readFileSync("./index.html");
posthtml()
.use(
noscript({
content: "You need to enable JavaScript to run this app.",
})
)
.process(html)
.then((result) => fs.writeFileSync("./after.html", result.html));
```
## Options
By default, the plugin prepends noscript markup inside the body tag.
Optionally, specify "head" as the parent tag to insert noscript content inside the head tag.
**Before:**
In 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.
```html
```
**Config:**
```js
const fs = require("fs");
const posthtml = require("posthtml");
const { noscript } = require("posthtml-noscript");
const html = fs.readFileSync("./index.html");
posthtml()
.use(
noscript({
content: '',
parent: "head",
})
)
.process(html)
.then((result) => fs.writeFileSync("./after.html", result.html));
```
**After:**
If JavaScript is disabled, custom fonts can still be loaded.
```html
```
## Contributing
See the [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs).
## [Changelog](CHANGELOG.md)
## License
[MIT](LICENSE)
[npm]: https://img.shields.io/npm/v/posthtml-noscript.svg?color=blue
[npm-url]: https://npmjs.com/package/posthtml-noscript