grunt-slimer-screenshot

Save screenshots of your pages using SlimerJS

Usage no npm install needed!

<script type="module">
  import gruntSlimerScreenshot from 'https://cdn.skypack.dev/grunt-slimer-screenshot';
</script>

README

grunt-slimer-screenshot

Save screenshots of any page using SlimerJS

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-slimer-screenshot --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-slimer-screenshot');

SlimerJS

The module uses SlimerJS for taking screenshots. If you have troubles with SlimerJS, refer to the project documentation page SlimerJS documentation.

Troubleshooting

The "slimer_screenshot" task

Overview

In your project's Gruntfile, add a section named slimer_screenshot to the data object passed into grunt.initConfig().

grunt.initConfig({
  slimer_screenshot: {
        target: {
          options: {
            width: 600,
            height: 600,
            savingDir: "./screen/",
            delay: 600
          },
          files: {
            'shot1.png': 'https://google.com'
          }
        }
    }
});

Options

options.width

Type: Number Default value: 1024

SlimerJS viewport width.

options.height

Type: Number Default value: 768

SlimerJS viewport height.

options.savingDir

Type: String Default value: ./

Folder where screenshots are saved.

options.delay

Type: Number Default value: 0

Delay before taking screenshot.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2016-06-16   v0.1.4   Initial version
  • 2017-03-27   v0.2.0   Use of the SlimerJS package (0.10.3) as a dependency
  • 2017-03-28   v0.2.1   Readme update
  • 2018-06-13   v0.3.0   Upgraded to SlimerJS v1.0.0 - removed usage of XVFB for headless execution - use instead --headless for SlimerJS (available starting FF 56)