ucss icon indicating copy to clipboard operation
ucss copied to clipboard

Bug or outdated docs?

Open npearson72 opened this issue 4 years ago • 0 comments

I'm following your README:

// css can be an array of strings, file paths, or URLs
var css = [".foo {} .bar {} .baz {}"];

// html can be an array of strings, file paths, or URLs
var html = ["<html><head></head><body class='foo'></body></html>"];

var context = {
    whitelist: [".baz"], // CSS selectors to ignore
    auth: null, // For login (please se example elsewhere)
    timeout: 400 // Request timeout (defaults to 400ms)
};
var logger = null; // Function for logging HTTP requests

// Do the magic
ucss.analyze(html, css, context, logger, function(result) {
    // Do something to the result object
    console.log(result);
});

When I run this, I get:

> node index.js

{
  selectors: {
    '.foo': {
      ignored: false,
      whitelisted: false,
      matches_html: 0,
      matches_uris: [],
      occurences_css: 1,
      pos_css: [Object]
    },
    '.bar': {
      ignored: false,
      whitelisted: false,
      matches_html: 0,
      matches_uris: [],
      occurences_css: 1,
      pos_css: [Object]
    },
    '.baz': {
      ignored: false,
      whitelisted: true,
      matches_html: 0,
      matches_uris: [],
      occurences_css: 1,
      pos_css: [Object]
    }
  },
  total: 3,
  total_used: 0,
  total_unused: 2,
  total_duplicates: 0,
  total_ignored: 1,
  load_errors: []
}

This doesn't seem correct. Shouldn't there be 1 used?

npearson72 avatar Jan 20 '21 22:01 npearson72