<commit_before># grunt-grep
[![Build Status](https://travis-ci.org/msemenistyi/grunt-grep.png)](https://travis-ci.org/msemenistyi/grunt-grep)

> Remove lines that match defined patterns within comments sections. Build several versions of file 

## Getting Started
This plugin requires Grunt `~0.4.1`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-grep --save-dev
```

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

```js
grunt.loadNpmTasks('grunt-grep');
```

## The "grep" task

### Overview
Create several versions of one file for different environments, needs etc. Handle several files which not differ much in one file with help of comments. 
Handle browser-specific features for building different html, css, js or any other files for better user experience by delivering no more instructions than is required. 

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

```js
grunt.initConfig({
	grep: {
		production: {
			files: {
				'tmp/boot.css': ['test/fixtures/boot.css'], //dest file with lines matching pattern excluded: src files
				'tmp/styles': ['test/fixtures/*.styl'] //src could be presented as a wildcard, new files with corresponding names will be created in the dest folder
			},
			options: {
				pattern: 'dev' //your pattern that will be excluded from file
			}
		}
	}
})
```

### Basic file types supported
+ css
+ js
+ html
+ styl
+ jade

### Options
**pattern** `Type String`
pattern for matching lines that should be removed (e.g. 'not_important');
**startPattern** `Type String`
grep could remove several lines by looking for opening and ending pattern. By default **:s** (so comment should be '//not_important:s');
**endPattern** `Type String`
ending pattern for multi-line support. By default **:e** (so comment should be '//not_important:e');
**fileOverride** `Type Boolean`
if grep finds out that dest file exists, it file remove it first. By default **false**.

### Usage Examples

#### Source files
*index.html*
```html
<link rel="stylesheet" href="./style.css"> <!--dev-->
<link rel="stylesheet" href="http://some.cdn/style.css"> <!--production-->
```
*style.css*
```css
#image{
	background-image: url("./style.css"); //dev
	background-image: url("http://some.cdn/style.css"); //production
}<commit_msg>update REAMDE. fixed lines breaking<commit_after># grunt-grep
[![Build Status](https://travis-ci.org/msemenistyi/grunt-grep.png)](https://travis-ci.org/msemenistyi/grunt-grep)

> Remove lines that match defined patterns within comments sections. Build several versions of file 

## Getting Started
This plugin requires Grunt `~0.4.1`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-grep --save-dev
```

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

```js
grunt.loadNpmTasks('grunt-grep');
```

## The "grep" task

### Overview
Create several versions of one file for different environments, needs etc. Handle several files which not differ much in one file with help of comments. 
Handle browser-specific features for building different html, css, js or any other files for better user experience by delivering no more instructions than is required. 

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

```js
grunt.initConfig({
	grep: {
		production: {
			files: {
				'tmp/boot.css': ['test/fixtures/boot.css'], //dest file with lines matching pattern excluded: src files
				'tmp/styles': ['test/fixtures/*.styl'] //src could be presented as a wildcard, new files with corresponding names will be created in the dest folder
			},
			options: {
				pattern: 'dev' //your pattern that will be excluded from file
			}
		}
	}
})
```

### Basic file types supported
+ css
+ js
+ html
+ styl
+ jade

### Options
**pattern** `Type String`  
pattern for matching lines that should be removed (e.g. 'not_important');  
**startPattern** `Type String`  
grep could remove several lines by looking for opening and ending pattern. By default **:s** (so comment should be '//not_important:s');  
**endPattern** `Type String`  
ending pattern for multi-line support. By default **:e** (so comment should be '//not_important:e');  
**fileOverride** `Type Boolean`  
if grep finds out that dest file exists, it file remove it first. By default **false**.  

### Usage Examples

#### Source files
*index.html*
```html
<link rel="stylesheet" href="./style.css"> <!--dev-->
<link rel="stylesheet" href="http://some.cdn/style.css"> <!--production-->
```
*style.css*
```css
#image{
	background-image: url("./style.css"); //dev
	background-image: url("http://some.cdn/style.css"); //production
}
{'fraction_non_alphanumeric': 0.13090841949778434, 'fraction_numerical': 0.0011078286558345643, 'mean_word_length': 4.331692913385827, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2417912', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1572, 'n_words': 638}