This repository has been archived by the owner. It is now read-only.
Simple tool for filtering HTML using CSS selectors.
Clone or download
Comandeer Merge pull request #48 from Comandeer/greenkeeper/codecov-2.0.1
Update codecov to the latest version 🚀
Latest commit 8e4936e Mar 16, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
config
docs/tutorials
src
tests
.editorconfig
.gitignore
.travis.yml ci(Travis): fix invalid CodeCov command Nov 28, 2016
CHANGELOG.md Merge remote-tracking branch 'boilerplate/master' Dec 6, 2016
CONTRIBUTING.md
LICENSE [ci skip] Updated package & author's data. Jul 27, 2016
README.md
bower.json
package.json

README.md

css-filter

Build Status · Dependency Status · devDependency Status · Known Vulnerabilities · npm version · Bower version · codecov

Library for filtering HTML with CSS selectors.


Installation

You can install this package from npm:

npm install @comandeer/css-filter [--save]

You can also install it from bower:

bower install css-filter

Usage

Include script in your site:

<script src="node_modules/@comandeer/css-filter/dist/css-filter.umd.js"></script>

Under window.cssFilter you will find our library with some fancy methods (see API docs for details).

The simplest way to use the library is to create filter using the factory:

const filter = cssFilter.default( 'i' );
const filtered = filter.filter( `<div>
	<span>
		<i>Only i tag will be preserved</i>
	</span>
</div>` );

console.log( filtered.innerHTML ); // <i>Only i tag will be preserved</i>

All valid CSS selectors could be used as a rule (however not all valid CSS selectors make sense as such rules…).

Documentation

API docs are available at http://comandeer.github.io/css-filter