Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uncss

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uncss - npm Package Compare versions

Comparing version 0.7.8 to 0.7.9

23

lib/lib.js

@@ -90,2 +90,5 @@ 'use strict';

*/
/* Fix the case when there is a query string or hash */
sheet = sheet.split('?')[0].split('#')[0];
if (sheet[0] === '/' && options.htmlroot) {

@@ -139,12 +142,14 @@ _path = path.join(options.htmlroot, sheet);

/* Match only specified media attributes, plus defaults */
media = 'link[rel="stylesheet"]:not(media),' + media.map(function (selector) {
return 'link[rel="stylesheet"]' + '[media="' + selector + '"]';
}).join(', ');
stylesheets = dom('link[rel="stylesheet"]');
stylesheets = dom(media);
/* Stylesheets is not an array, but an object whose elements are indexes */
return _.toArray(stylesheets).map(function (x) {
return x.attribs.href;
return _
/* Stylesheets is not an array, but an object whose elements are indexes */
.toArray(stylesheets)
/* Match only specified media attributes, plus defaults */
.filter(function (sheet) {
return sheet.attribs.media === undefined ||
media.indexOf(sheet.attribs.media) !== -1;
})
.map(function (sheet) {
return sheet.attribs.href;
});

@@ -151,0 +156,0 @@ }

@@ -121,7 +121,4 @@ 'use strict';

report = {
original : Buffer.byteLength(css_str),
tidy : Buffer.byteLength(used_css)
original: css_str
};
} else {
report = 'Option report was set to false';
}

@@ -158,8 +155,8 @@

/* Assign default values to options, unless specified */
options.csspath = options.csspath || '';
options.ignore = options.ignore || [];
options.media = options.media || [];
options.timeout = options.timeout || 0;
options.report = options.report || false;
options.ignoreSheets = options.ignoreSheets || [];
options.csspath = options.csspath || '';
options.ignore = options.ignore || [];
options.media = options.media || [];
options.timeout = options.timeout || 0;
options.report = options.report || false;
options.ignoreSheets = options.ignoreSheets || [];

@@ -166,0 +163,0 @@ /* If 'files' is a string, it should represent an HTML page. */

{
"name": "uncss",
"version": "0.7.8",
"version": "0.7.9",
"author": "Giakki",

@@ -45,4 +45,4 @@ "description": "Remove unused CSS styles",

"phantomjs": "~1.9.7-1",
"request": "~2.33.0",
"underscore": "~1.5.2"
"request": "~2.34.0",
"underscore": "~1.6.0"
},

@@ -54,5 +54,5 @@ "devDependencies": {

"grunt-contrib-jshint": "~0.8.0",
"grunt-mocha-cov": "~0.2.0",
"grunt-mocha-cov": "~0.2.1",
"load-grunt-tasks": "~0.3.0",
"time-grunt": "~0.2.8"
"time-grunt": "~0.2.9"
},

@@ -59,0 +59,0 @@ "engines": {

@@ -34,3 +34,2 @@ # UnCSS

timeout : 1000,
report : true,
htmlroot : 'public'

@@ -48,9 +47,2 @@ };

/* Check out how much you've reduced your filesize! */
uncss(files, function (error, output, report) {
console.log(output);
console.log('Original: ', report.original/1000, 'kilobytes');
console.log('Tidy: ', report.tidy/1000, 'kilobytes');
});
/* Specifying raw HTML

@@ -57,0 +49,0 @@ * NOTE: raw HTML is not parsed by PhantomJS

Sorry, the diff of this file is not supported yet

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