https://github.com/posthtml/posthtml-remove-tags
A posthtml plugin for removing tags
https://github.com/posthtml/posthtml-remove-tags
Last synced: 4 months ago
JSON representation
A posthtml plugin for removing tags
- Host: GitHub
- URL: https://github.com/posthtml/posthtml-remove-tags
- Owner: posthtml
- License: mit
- Created: 2016-08-09T08:31:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-23T11:36:29.000Z (almost 8 years ago)
- Last Synced: 2025-10-01T12:33:55.760Z (5 months ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# posthtml-remove-tags
> A [posthtml](https://github.com/posthtml) A posthtml plugin for removing tags
[](https://travis-ci.org/GitScrum/posthtml-remove-tags)[](https://ci.appveyor.com/project/GitScrum/posthtml-remove-tags)[]()[](https://www.npmjs.com/package/posthtml-remove-tags)[](https://david-dm.org/gitscrum/posthtml-remove-tags)[](https://github.com/sindresorhus/xo)[](https://coveralls.io/r/GitScrum/posthtml-remove-tags)
[](https://www.npmjs.com/package/posthtml-remove-tags)[](https://www.npmjs.com/package/posthtml-remove-tags)[](http://packagequality.com/#?package=posthtml-remove-tags)
## Why?
Essential for removing unwanted or tags do not pass validation
## Install
```bash
npm i -S posthtml posthtml-remove-tags
```
> **Note:** This project is compatible with node v4+
## Usage
```js
import {readFileSync, writeFileSync} from 'fs';
import posthtml from 'posthtml';
import removeTags from 'posthtml-remove-tags';
const html = readFileSync('input.html', 'utf8');
posthtml()
.use(removeTags({tags: ['style', 'script']}))
.process(html)
.then(result => {
writeFileSync('output.html', result.html);
});
```
Returns the html without the tags listed in option
## Example
#### input.html
```html
```
#### output.html
```html
```
## Options
#### `tags`
Type: `Array`
Default: `[]`
Description: *The list of tags to be deleted*
## LICENSE
[MIT](license)