0.0.5 • Published 7 years ago

grunt-pug-format v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

grunt-pug-format

A grunt wrapper for Jade-Beautify or Pug-Beautify.

Getting Started

This plugin usgin pug-beautify

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-pug-format --save-dev

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

grunt.loadNpmTasks('grunt-pug-format');

The "pug_beautify" task

Overview

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

grunt.initConfig({
  pug_beautify: {
    expand: true,
    cwd: 'src/views/',
    src: '*.pug',
    dest: 'src/views/beautify',
    options: {
      fill_tab: false,
      omit_div: true,
      tab_size: 2,
      separator_space: true,
      omit_empty_lines: true 
    }
  }
});

Options

  • fill_tab - boolean, fill whether tab or space, default true.
  • omit_div - boolean, whether omit 'div' tag, default false.
  • tab_size - number, when 'fill_tab' is false, fill 'tab_size' spaces, default 4.
  • separator_space - boolean, When 'separator_space' is true, the attribute separator is comma, default true.
  • omit_empty_lines - When 'separator_space' is false, delete line blank, default true.