posthtml-remove-tags

0.1.0 • Public • Published

remove tags

A posthtml A posthtml plugin for removing tags

Travis Build StatusAppVeyor Build Statusnodenpm versionDependency StatusXO code styleCoveralls status

npm downloadsnpmPackage Quality

Why?

Essential for removing unwanted or tags do not pass validation

Install

npm i -S posthtml posthtml-remove-tags

Note: This project is compatible with node v4+

Usage

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

<!DOCTYPE html>
<head><style></style></head>

output.html

<!DOCTYPE html>
<head></head>

Options

tags

Type: Array
Default: []
Description: The list of tags to be deleted

LICENSE

MIT License (MIT)

Copyright (c) Ivan Demidov scrum@list.ru

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i posthtml-remove-tags

Weekly Downloads

532

Version

0.1.0

License

MIT

Last publish

Collaborators

  • cossssmin
  • scrum
  • voischev