npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-accessibility-html-report-converter

v3.1.3

Published

Converts the JSON report of the grunt-accessibility task to HTML.

Downloads

19

Readme

grunt-accessibility-html-report-converter

NPM version Build Status Dependency Status devDependency Status io/) Built with Grunt semantic-release

NPM Downloads

This module provides a grunt multi-task for converts the JSON report generated by the grunt-accessibility task to the HTML format. It uses grunt-accessibility-html-reporter to format the accessibility check results.

Installation

You need node >= 4, npm and grunt >= 0.4.5 installed and your project build managed by a Gruntfile with the necessary modules listed in package.json; including grunt-accessibility. 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-accessibility-html-report-converter --save-dev

Configuration

Add the accessibility-html-report-converter entry with the task configuration to the options of the grunt.initConfig method:

grunt.initConfig({
  'accessibility-html-report-converter': {
    all: {
      src: 'accessibility/report.json',
      dest: 'accessibility/report.html'
    }
  }
});

Default options support the most usual usage scenario:

'accessibility-html-report-converter': {
  options: {
    targetExtension: '.html',
    ignoreMissing: false,
    showFileNameOnly: false,
    showCommonPathOnly: true,
    force: false
  },
  all: {
    src: 'accessibility/report.json',
    dest: 'accessibility/report.html'
  }
}

Task Options

force

Type: Boolean Default value: false

If set to true, it suppresses failures, which happened during the report conversion. Instead of making the Grunt fail, the errors will be written only to the console.

ignoreMissing

Type: Boolean Default: false

If the src property does not point to any files, or if it is missing, the task will make the Grunt run fail. If you set the ignoreMissing option to true, Grunt will continue executing other tasks.

targetExtension

Type: String Default: ".html:

If the dest property specified only the target directory, the converted report file will be stored there with the file extension replaced to ".html" or to the extesion specified by this property.

showFileNameOnly

Type: Boolean Default value: false

Cuts the directory from tested HTML files, when creating page titles from in the report. If you use unique names for files alone, you will not get too long page titles, if you flip this flag tp true.

Task Data

The configuration consists of src and dest property pairs. The src property has to point to an existing source path. The dest property has to point to the path, where the converted report should be written.

If you do not end the dest path by the path separator (slash, for example), the dest path will be considered as if it includes the converted report file name too.

If you end the dest path by a path separator (slash, for example), the converted report will be created using the source report name with the HTML expension.

If you specify more source files or directories, or use wildcards, the target path should be a directory - ended by the path separator (slash, for example).

src

Type: String or Array

Path to the file with the JSON report generated by the accessibility task, or a path pattern identifying these file, or an array of these.

dest

Type: String

Path to the file, which will be the HTML report written to. Or only the path to the directory, where it should be written, if the source report name with the HTML expension shoudl be used.

Loading

Load the plugin in Gruntfile.js:

grunt.loadNpmTasks('grunt-accessibility-html-report-converter');

Build

Call the accessibility-html-report-converter task:

$ grunt accessibility-html-report-converter

or integrate it to your build sequence in Gruntfile.js:

grunt.registerTask('default', ['accessibility-html-report-converter', ...]);

Notes

This task will be usually executed right after the accessibility task. For example:

grunt.initConfig({
  accessibility: {
    all: {
      src: ['snapshots/*.html']
    }
  },

  'accessibility-html-report-converter': {
    all: {
      src: 'accessibility/report.json',
      dest: 'accessibility/'
    }
  }
});

grunt.loadNpmTasks('grunt-accessibility');
grunt.loadNpmTasks('grunt-accessibility-html-report-converter');

grunt.registerTask('default', [
  'accessibility', 'accessibility-html-report-converter']);

The installation of the necessary Grunt tasks:

npm install grunt-accessibility grunt-accessibility-html-report-converter --save-dev

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

  • 2018-05-14 v3.1.0 Allow cutting the same initial part of the path from tested HTML files for displaying purposes
  • 2018-04-27 v3.0.0 Dropped support of Node.js 4
  • 2018-03-05 v2.2.0 Upgrade to the reporter v2.2.0, allow generating page titles from file names without directory
  • 2018-03-04 v2.1.0 Upgrade to the reporter v2.1.0
  • 2018-03-01 v2.0.1 Upgrade to the reporter v2.0.2
  • 2018-02-19 v2.0.0 Upgrade to the reporter v2.0.0
  • 2018-02-19 v1.0.0 Upgrade to the reporter v1.0.0
  • 2017-11-25 v0.0.5 Fix appending the HTML extension to the target report file
  • 2017-11-25 v0.0.4 Upgrade the reporter dependency to support Node.js < 7
  • 2017-11-25 v0.0.1 Initial release

License

Copyright (c) 2017-2019 Ferdinand Prantl

Licensed under the MIT license.