grunt-remove-empty-lines

2.0.0 • Public • Published

grunt-remove-empty-lines

Very simple and lightweight cleaner that just removes empty lines from specific parts of any kind of files

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 grunt-remove-empty-lines --save-dev

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

grunt.loadNpmTasks('grunt-remove-empty-lines');

Options

options.regex

Type: RegExp Default value: /(?:[ |\t]*<!--\(\s?remove-empty-lines-start\s?\)-->)\n?([\s\S]+?)(?:[ |\t]*<!--\(\s?remove-empty-lines-end\s?\)-->)/g

Example:

Before

<!--(remove-empty-lines-start)-->
<meta charset="UTF-8">

<title>...</title>

<meta name="keywords" content="..." />
<meta name="description" content="...">

<meta name="author" content="...">

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!--(remove-empty-lines-end)-->

After

<meta charset="UTF-8">
<title>...</title>
<meta name="keywords" content="..." />
<meta name="description" content="...">
<meta name="author" content="...">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

Default Options

grunt.initConfig({
  removeemptylines: {
    options: {},
    files: {
      'dest/sampleFile.html': ['src/sampleFile.html']
    }
  }
});

Readme

Keywords

Package Sidebar

Install

npm i grunt-remove-empty-lines

Weekly Downloads

8

Version

2.0.0

License

none

Unpacked Size

9.13 kB

Total Files

8

Last publish

Collaborators

  • jonasklering