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

Add dimensions support to cli.js #457

Closed
vovayatsyuk opened this issue Jul 9, 2020 · 4 comments
Closed

Add dimensions support to cli.js #457

vovayatsyuk opened this issue Jul 9, 2020 · 4 comments

Comments

@vovayatsyuk
Copy link

What do you think about it?

... --dimensions 1300x900,400x700
@nachitox
Copy link

Did you try --dimensions 1300x900 400x700 ?

To me, --css CSS1 CSS2 ... CSSN works fine, so I would think dimensions should work too

@vovayatsyuk
Copy link
Author

Thanks, but it doesn't work:

node node_modules/critical/cli.js https://github.com --dimensions 1300x900 400x700
   Error: ConfigError: "dimensions" must be an array

Looks like css is working fine because of this commit: ccaeae1

  // Detect css globbing
  const cssBegin = process.argv.findIndex((el) => ['--css', '-c'].includes(el));
  const cssEnd = process.argv.findIndex((el, index) => index > cssBegin && el.startsWith('-'));
  const cssCheck = cssBegin >= 0 ? process.argv.slice(cssBegin, cssEnd > 0 ? cssEnd : undefined) : [];
  const additionalCss = inputs.filter((file) => cssCheck.includes(file));
  // Just take the first html input as we don't support multiple html sources for
  const [input] = inputs.filter((file) => !additionalCss.includes(file));


  if (Array.isArray(css)) {
    opts.css = [...css, ...additionalCss].filter((file) => file);
  } else if (css || additionalCss.length > 0) {
    opts.css = [css, ...additionalCss].filter((file) => file);
  }

bezoerb pushed a commit that referenced this issue Aug 18, 2020
@bezoerb
Copy link
Collaborator

bezoerb commented Aug 18, 2020

@vovayatsyuk: you. can now write --dimensions 1300x900,400x700 as well as --dimensions 1300x900 --dimensions 400x700

See https://github.com/addyosmani/critical/releases/tag/v2.0.3

@vovayatsyuk
Copy link
Author

Thank you!

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