Skip to content

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

License

Notifications You must be signed in to change notification settings

maaprote/grunt-remove-empty-lines

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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']
    }
  }
});

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 88.7%
  • HTML 11.3%