Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug or outdated docs? #51

Open
npearson72 opened this issue Jan 20, 2021 · 0 comments
Open

Bug or outdated docs? #51

npearson72 opened this issue Jan 20, 2021 · 0 comments

Comments

@npearson72
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant