grunt-xml-formatter

1.0.2 • Public • Published

grunt-xml-formatter

A Grunt wrapper for xml-formatter

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-xml-formatter xml-formatter --save-dev

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

grunt.loadNpmTasks('grunt-xml-formatter');

Usage

Run this task with the grunt xml-formatter command.

Examples

Add a section named xml-formatter to the data object passed into grunt.initConfig(), then pass in your files object or array.

Beautify XML file(s)

grunt.initConfig({
  'xml-formatter': {
    target: {
      options: {
        indentation: '  ',
        stripComments: true,
        collapseContent: false,
        debug: false
      },
      files: [{
        expand: true,
        cwd: 'src/',
        src: ['**/*.xml']
        dest: 'dest/'
      }]
    }
  }
});

Options

This grunt task uses the native options for xml-formatter.

Package Sidebar

Install

npm i grunt-xml-formatter

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

4.14 kB

Total Files

6

Last publish

Collaborators

  • laurenhamel