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

Error using minimalcss #282

Open
sfresta opened this issue Dec 1, 2018 · 1 comment
Open

Error using minimalcss #282

sfresta opened this issue Dec 1, 2018 · 1 comment

Comments

@sfresta
Copy link

sfresta commented Dec 1, 2018

Hello Peter,
thank you for minimalcss. I'm new with nodejs and I'm trying to use your module to extract critical CSS from an URL. I think it's my mistake but I can not bypass javascript errors. This is the code:

const minimalcss = require('/usr/local/lib/node_modules/minimalcss');

minimalcss
  .minimize({ ignoreJSErrors: true, ignoreCSSErrors: true, styletags: true, debug: false, urls: ['https://www.bottadiculo.it/staging/'] })
  .then(result => {
    console.log(result.finalCss);
  })
  .catch(error => {
    console.error(`Failed the minimize CSS: ${error}`);
  });

And this is the output:

$ nodejs minimalcss.js
Failed the minimize CSS: Error: 404 on https://api.quantcast.mgr.consensu.org/CookieAccess

Can you tell me where am I wrong? And how can I use the viewport for mobile?

I hope in your reply. Thank you so much!

@peterbe
Copy link
Owner

peterbe commented Dec 3, 2018

Does the URL https://www.bottadiculo.it/staging/ contain a <link rel="stylesheet" href="https://api.quantcast.mgr.consensu.org/CookieAccess"> or something similar? If so, it needs to be able to open that URL and download its content. If it can't do that, because that URL yields a 404 error, then you'd get that error.

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

3 participants
@peterbe @sfresta and others