Socket
Socket
Sign inDemoInstall

analyze-css

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analyze-css - npm Package Compare versions

Comparing version 0.12.2 to 0.12.3

5

lib/index.js

@@ -9,2 +9,3 @@ /**

fs = require('fs'),
path = require('path'),
preprocessors = new(require('./preprocessors'))(),

@@ -70,2 +71,6 @@ slickParse = require('slick').parse,

// @see https://github.com/macbre/phantomas/issues/664
analyzer.path = path.normalize(__dirname + '/..');
analyzer.pathBin = analyzer.path + '/bin/analyze-css.js';
// exit codes

@@ -72,0 +77,0 @@ analyzer.EXIT_NEED_OPTIONS = 2;

6

package.json
{
"name": "analyze-css",
"version": "0.12.2",
"version": "0.12.3",
"author": "Maciej Brencz <maciej.brencz@gmail.com> (https://github.com/macbre)",

@@ -23,3 +23,3 @@ "description": "CSS selectors complexity and performance analyzer",

"dependencies": {
"cli": "^0.11.3",
"cli": "^1.0.0",
"css": "2.2.x",

@@ -31,3 +31,3 @@ "css-shorthand-properties": "1.0.x",

"http-proxy-agent": "^1.0.0",
"node-fetch": "^1.6.0",
"node-fetch": "^1.6.1",
"onecolor": "^3.0.4",

@@ -34,0 +34,0 @@ "optimist": "0.6.x",

@@ -44,3 +44,3 @@ analyze-css

HTTP proxy can be provided via:
HTTP proxy (e.g. `http://localhost:8080`) can be provided via:

@@ -96,3 +96,2 @@ * `--proxy` or `-x` option

"complexSelectors": 37,
"complexSelectorsByAttribute": 3,
"duplicatedSelectors": 7,

@@ -125,3 +124,2 @@ "duplicatedProperties": 24,

"selectorsByTag": 533,
"universalSelectors": 5,
"length": 55173,

@@ -148,3 +146,2 @@ "rules": 433,

* **complexSelectors**: number of complex selectors (consisting of more than three expressions, e.g. ``header ul li .foo``)
* **complexSelectorsByAttribute**: number of selectors with complex matching by attribute (e.g. ``[class$="foo"]``)
* **duplicatedSelectors**: number of CSS selectors defined more than once in CSS source

@@ -177,3 +174,2 @@ * **duplicatedProperties**: number of CSS property definitions duplicated within a selector

* **selectorsByTag**: number of selectors by tag name
* **universalSelectors**: number of selectors trying to match every element (e.g. ``.foo > *``)
* **length**: length of CSS source (in bytes)

@@ -180,0 +176,0 @@ * **rules**: number of rules (e.g. ``.foo, .bar { color: red }`` is counted as one rule)

@@ -7,3 +7,2 @@ 'use strict';

analyzer.setMetric('complexSelectors');
analyzer.setMetric('complexSelectorsByAttribute');

@@ -17,22 +16,2 @@ // #foo .bar ul li a

});
// .foo[type*=bar]
// @see http://www.w3.org/TR/css3-selectors/#attribute-selectors
analyzer.on('expression', function(selector, expression) {
if (typeof expression.attributes !== 'undefined') {
switch (expression.attributes[0].operator) {
case '=':
break;
case '~=': // contains value in a whitespace-separated list of words
case '|=': // starts with value or value-
case '^=': // starts with
case '$=': // ends with
case '*=': // contains
analyzer.incrMetric('complexSelectorsByAttribute');
analyzer.addOffender('complexSelectorsByAttribute', selector);
break;
}
}
});
}

@@ -39,0 +18,0 @@

@@ -7,21 +7,3 @@ exports.tests = [

}
},
{
css: 'input[class$="span"] {}',
metrics: {
complexSelectorsByAttribute: 1
}
},
{
css: '[class*="span"] {}',
metrics: {
complexSelectorsByAttribute: 1
}
},
{
css: '[class="span"] {}',
metrics: {
complexSelectorsByAttribute: 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