Skip to content
New issue

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

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

Already on GitHub? # to your account

Viewports in separate files #905

Closed
movie4 opened this issue Oct 31, 2018 · 2 comments
Closed

Viewports in separate files #905

movie4 opened this issue Oct 31, 2018 · 2 comments

Comments

@movie4
Copy link

movie4 commented Oct 31, 2018

Hello!

I have 12+ config files with scenarios and in each config file i use equal viewports options

Can BackstopJS use separate config file for viewports like --config?

It would be cool use this like:

backstop test --config='./path_to_config' --viewports='./path_to_viewports'
@brendonbribeiro
Copy link
Contributor

You could use .js config file instead of json. Then create a file viewports.js

module.exports = [
    {
      label: 'phone',
      width: 320,
      height: 480
    },
    {
      label: 'tablet',
      width: 1024,
      height: 768
    }
  ]

And then, in your config.js files:

const viewports = require('./viewports');

module.exports = {
   id: 'config_id',
   viewports: viewports
   ...
}

@steveycee
Copy link

You could use .js config file instead of json. Then create a file viewports.js

module.exports = [
    {
      label: 'phone',
      width: 320,
      height: 480
    },
    {
      label: 'tablet',
      width: 1024,
      height: 768
    }
  ]

And then, in your config.js files:

const viewports = require('./viewports');

module.exports = {
   id: 'config_id',
   viewports: viewports
   ...
}

This method solved the problem for me.

@movie4 movie4 closed this as completed Dec 17, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants