Socket
Socket
Sign inDemoInstall

filter-css

Package Overview
Dependencies
114
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    filter-css

Filter CSS rules


Version published
Maintainers
1
Install size
3.53 MB
Created

Readme

Source

filter-css Build Status

Filter CSS rules

Install

$ npm install --save filter-css

Usage

body {
	margin: 0;
	padding: 0;
}

@font-face {
	font-family: 'Glyphicons Halflings';
}
Match @type
var filterCss = require('filter-css');

filterCss('test/fixtures/test.css',['@font-face']);
//=> 
body {
	margin: 0;
	padding: 0;
}
Match RegExp
var filterCss = require('filter-css');

filterCss('test/fixtures/test.css',[/bod/]);
//=> 
@font-face {
	font-family: 'Glyphicons Halflings';
}
Filter Declaration
.bigBackground {
	width: 100%;
	height: 100%;
	background-image: url('some/big/image.png');
}
var filterCss = require('filter-css');

filterCss('test/fixtures/test.css',[/url\(/]);
//=> 
.bigBackground {
	width: 100%;
	height: 100%;
}

CLI

filter-css works well with standard input.

$ cat test/fixture/test.css | filtercss --ignore @font-face

You can also pass in the file as an option.

$ filtercss test/fixture/test.css --ignore @font-face

API

filterCss(input, [ignores])

input

Required
Type: string

CSS filepath or raw css string.

ignores

Type: array

List of RegExp, @type or selectors to remove

License

MIT © Ben Zörb

Keywords

FAQs

Last updated on 01 May 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc