happo/happo.io

Possibility to replace config parameters in CLI with CLI args

jack-sf opened this issue · 4 comments

For example, even if my .happo.js includes


  targets: {
    'chrome-desktop': new RemoteBrowserTarget('chrome', {
      viewport: '1200x768',
    }),
    // 'chrome-mobile': new RemoteBrowserTarget('chrome', {
    //   viewport: '320x640',
    // }),
    // 'safari-desktop': new RemoteBrowserTarget('safari', {
    //   viewport: '1200x768',
    // }),
    'safari-mobile': new RemoteBrowserTarget('safari', {
      viewport: '320x640',
    }),
    ie11: new RemoteBrowserTarget('internet explorer', {
      viewport: '1200x768',
    }),
    // Happo currently throws error 500 for ios-safari builds
    // TODO turn it back on when Happo team fixes it
    // iphone: new RemoteBrowserTarget('ios-safari', {
    //   viewport: '375x667',
    // }),
  },

if I could do happo run --targets ie11 or happo dev --targets safari-mobile , I could limit the targets to be enabled on this run only to the specified targets.

(Similarly as --only xxx works in happo dev mode.)

This would be a nice addition, thanks for suggesting it!

I can't make any promises to when we'll get to this, so I'd be very happy to accept a PR! I think the easiest way would be to start at src/executeCli.js, add another commander option (--targets?), pass that value to loadUserConfig and have it filter out the right targets.

...and sorry about the instability of ios-safari. I'm working on that, I hope to have an update for you soon!

Would a --target be a better name?

That would work too. I don't feel strongly about it, as long as you're able to specify one or more targets. Either --targets ie,chrome or --target chrome --target ie, I'm okay with both.