gpageinsights

0.0.5 • Public • Published

gpageinsights

Build Status Coverage Status

NPM version

Ensure specific Google Page Insight tests are passing before your build passes. (eg use case: I want the build to fail if Javascript and HTML are not minified or if Impact of Render Blocking resources is too high) For best usage, use it with ngrok (Obtain a web url for localhost and run insights against the web url that has access to your localhost server) Refer demoblog's Grunfile.js for an example.

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

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

grunt.loadNpmTasks('gpageinsights');

The "gpageinsights" task

Overview

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

grunt.initConfig({
  gpageinsights: {
    options: {
      url: MY_WEB_URL_OR_NGROK_URL
      /*Add verify_GOOGLE_INSIGHT_NAME : EXPECTED_SCORE*/
      /*eg: verify_MinifyCss: 0, verify_MinifyJavaScript: 0*/      
    }
  },
});

Options

verify_GOOGLE_INSIGHT_PROPERTY_NAME - To ensure exact score match verifymin_GOOGLE_INSIGHT_PROPERTY_NAME - To ensure minimum score match

grunt.initConfig({
  gpageinsights: {
    options: {
      url: MY_WEB_URL_OR_NGROK_URL.
      verify_MinifyCss: 0, 
      verify_MinifyJavaScript: 0,
      minverify_MinimizeRenderBlockingResources: 1      
    }
  },
});

Usage Examples

Ensure Javascript and CSS are minfied

grunt.initConfig({
  gpageinsights: {
    options: {
      url: MY_WEB_URL_OR_NGROK_URL,      
      verify_MinifyCss: 0, 
      verify_MinifyJavaScript: 0
    },    
  },
});

Readme

Keywords

Package Sidebar

Install

npm i gpageinsights

Weekly Downloads

1

Version

0.0.5

License

none

Last publish

Collaborators

  • prasunsultania