Home

Awesome

grunt-bootlint

A Grunt wrapper for Bootlint, the HTML linter for Bootstrap projects

NPM version Build Status MIT License Dependency Status devDependency Status

Getting Started

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

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

grunt.loadNpmTasks('grunt-bootlint');

The "bootlint" task

Overview

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

grunt.initConfig({
  bootlint: {
    options: {
      stoponerror: false,
      relaxerror: []
    },
    files: ['path/to/file.html', 'path/to/*.html']
  }
});

Options

Usage Examples

Default Options

In this example, the default options are used to lint files for common problems in bootstrap.

grunt.initConfig({
  bootlint: {
    options: {
      relaxerror: [],
      showallerrors: false,
      stoponerror: false,
      stoponwarning: false
    },
    files: ['test/fixtures/*.html']
  }
});

Settings

options.stoponerror

Breaks out of grunt task on first error problem ID. Use --force to force continue.

options.stoponwarning

Breaks out of grunt task on first warning problem ID. Use --force to force continue.

options.showallerrors

Shows all errors and warnings before stopping the task. (Overrides stoponerror and stoponwarning, above.)

options.relaxerror

Array of bootlint problem ID codes (Strings) to explicitly ignore.

Object of bootlint problem ID codes as keys and filepath globs as array value.

Example
relaxerror: {
  'E001': [],
  'W005': [
    'path/to/file.html',
    'file/path/*.glob'
  ]
},

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

License and copyright

Code released under the MIT license.