New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

html-processor

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-processor

Clean and enhance your offline HTML files

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

HTML Processor

Clean and enhance your offline HTML files

html-processor is a simple Node.js module that allows you to process a batch of html files programmatically or through the command line. html-processor will allow the following operations:

  • remove elements specified by a jquery selector
  • add custom styles
  • create new elements in defined locations
  • custom operations, coded in a JavaScript function

Usage

install through npm ny running:

npm install html-processor

require the module from your Node.js application:

var cleanFiles = require('html-processor'); cleanFiles();

cleanjs exports a function that takes 5 parameters. If you call the function without any parameters and run the above code from the command line, you will be prompted for them. Otherwise you can provide the parameters in your application:

cleanFiles(directory, elementsToDelete, customStyles, customFunction, callback);

directory: the absolute path to the directory containing your html content

elementsToDelete: a string of comma separated jQuery selectors to specify elements to delete

customStyles: A set of css rules defined as a string to be applied to each page

customFunction: A custom js function. The function should take one parameter 'html', which is the full HTML document as a jQuery variable. It should return the same varaible after manipulation.

callback:

Examples - download these from the git repo

  • Use example.js to process the data in /test-data. To do this open a command prompt in the 'examples' directory and run:

node example.js

  • Use commandUse.js to fill in the parameters at the command line. Open a command prompt in the root directory and run:

node commandUse.js

Keywords

html

FAQs

Package last updated on 25 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts