Socket
Socket
Sign inDemoInstall

filter-css

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-css - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

cli.js

@@ -33,3 +33,3 @@ 'use strict';

if (match) {
return new RegExp(_.escapeRegExp(match[1]),match[2]);
return new RegExp(match[1],match[2]);
}

@@ -36,0 +36,0 @@ return ignore;

@@ -14,12 +14,18 @@ 'use strict';

* @param {array} ignore
* @param {string} key
* @returns {Function}
*/
function identifySelectors(ignore) {
return function (selector) {
function identify(ignore,key) {
return function (element) {
if (_.isObject(element) && key) {
element = _.result(element,key);
}
for (var i = 0; i < ignore.length; ++i) {
/* If ignore is RegExp and matches selector ... */
if (_.isRegExp(ignore[i]) && ignore[i].test(selector)) {
if (_.isRegExp(ignore[i]) && ignore[i].test(element)) {
return true;
}
if (ignore[i] === selector) {
if (ignore[i] === element) {
return true;

@@ -32,2 +38,3 @@ }

/**

@@ -56,5 +63,7 @@ *

} else if (rule.type === 'rule') {
rule.selectors = _.reject(rule.selectors || [], identifySelectors(ignore));
rule.selectors = _.reject(rule.selectors || [], identify(ignore));
if (_.size(rule.selectors)) {
rule.declarations = _.reject(rule.declarations || [], identify(ignore,'value'));
rules.push(rule);

@@ -61,0 +70,0 @@ }

{
"name": "filter-css",
"version": "0.0.1",
"description": "My slick module",
"version": "0.0.2",
"description": "Filter CSS rules",
"license": "MIT",

@@ -26,3 +26,5 @@ "repository": "bezoerb/filter-css",

"keywords": [
""
"css",
"filter",
"parse"
],

@@ -29,0 +31,0 @@ "dependencies": {

@@ -54,2 +54,35 @@ # filter-css [![Build Status](https://travis-ci.org/bezoerb/filter-css.svg?branch=master)](https://travis-ci.org/bezoerb/filter-css)

#### Filter Declaration
```css
.bigBackground {
width: 100%;
height: 100%;
background-image: url('some/big/image.png');
}
```
```js
var filterCss = require('filter-css');
filterCss('test/fixtures/test.css',[/url\(/]);
//=>
```
```css
.bigBackground {
width: 100%;
height: 100%;
}
```
## CLI
filter-css works well with standard input.
```shell
$ cat test/fixture/test.css | filtercss --ignore @font-face
```
You can also pass in the file as an option.
```shell
$ filtercss test/fixture/test.css --ignore @font-face
```
## API

@@ -56,0 +89,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc