/grunt-webshot

Grunt plugin to run webshot and take screenshots of webpages and local html

Primary LanguageHTMLMIT LicenseMIT

grunt-webshot

Grunt plugin to run webshot and take screenshots of webpages and local html.

Build Status Dependency Status NPM version

A simple (naïve) wrapper for webshot that uses phantomJS to render webpages to various image formats.

For example generate preview images of your project to send to clients, update screenshots for your documentation or get creative with the browser rendering engine. Use webshot features like offsets, timers and a 'trigger' callback for interesting setups.

Getting Started

This plugin requires Grunt ~0.4.1

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-webshot --save-dev

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

grunt.loadNpmTasks('grunt-webshot');

The "webshot" task

Options

The grunt-webshot specific options are:

  • Required site and savePath are used as arguments to call the webshot method.

All other options are passed directly to webshot: see the documentation for a list of supported options.

grunt.initConfig({
	webshot: {
		// example
		homepage: {
			options: {
				// url, file or html
				siteType: 'url',
				site: 'https://github.com/Bartvds/grunt-webshot',
				savePath: './tmp/shot.png',
				windowSize: {
					width: 1024,
					height: 768
				},
				shotSize: {
					width: 1024,
					height: 'all'
				}
			}
		}
	}
});

History

  • 0.0.3 - Updated to webshot 0.8.1 (supports siteType:file), dropped own hack
  • 0.0.2 - Updated dependency
  • 0.0.1 - First release

Contributing

Contributions are very welcome, please leave a ticket before doing something major.

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.

Bitdeli Badge