New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

grunt-autoshot

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-autoshot

Create a quick screenshot for your site which could help for document or testing.


Version published
Weekly downloads
12
increased by9.09%
Maintainers
1
Weekly downloads
 
Created

grunt-autoshot Build Status

Create a quick screenshot for your site which could help for document or testing. Inspired by Testing your responsive design with PhantomJS, also suport different resolution base on your viewport, it's useful to responsive design.

Getting Started

This plugin requires Grunt.

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

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

grunt.loadNpmTasks('grunt-autoshot');

Final and the most important thing, please make sure phantomjs are in your PATH, cause this plugin use it to generate screenshot, so remember install first.

The "autoshot" task

Overview

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

grunt.initConfig({
  autoshot: {
    default_options: {
      options: {
        // necessary config
        path: '',
        filename: '',
        type: '',
        // optional config, must set either remote or local
        remote: '',
        local: '',
        viewport: [] 
      },
    },
  },
})

Options

options.path

Type: String

Path to the directory which screenshots will be saved.

options.filename

Type: String

Default filename of screenshots.
It will combine with local, remote and viewport.

ex: [local|remote]-{filename}-{viewport}
options.type

Type: String

Image type of screenshot.
PhantomJS supports JPEG, PNG, GIF and PDF right now.

options.remote

Type: String

The url of target webpage.

ex: http://www.google.com
options.local

Type: String

Start a local http server to host your webpage then get the screenshot. There are several config options:

{
  path: './dist', // path to directory of the webpage
  port: 8080      // port of startup http server
}
options.viewport

Type: Array

Autoshot could create the screenshot base on given viewport, it's helpful if you want to test responsive webpage.

ex: ['1024x768', '1920x1080']

You could add any resolution you want, just follow the same format.

License

Copyright (c) 2013 Ferrari Lee. Licensed under the MIT license.

Keywords

FAQs

Package last updated on 17 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts