<commit_before># gulp-common-build-tasks
[![NPM Version](https://img.shields.io/npm/v/gulp-common-build-tasks.svg?style=flat-square)](https://www.npmjs.org/package/gulp-common-build-tasks)
[![Download Month](https://img.shields.io/npm/dm/gulp-common-build-tasks.svg?style=flat-square)](https://www.npmjs.org/package/gulp-common-build-tasks)

You can found in this library some utilities and tasks that can be shared between multiple gulp's build processes.<commit_msg>Readme is back because it is working on npm.<commit_after># gulp-common-build-tasks
[![NPM Version](https://img.shields.io/npm/v/gulp-common-build-tasks.svg?style=flat-square)](https://www.npmjs.org/package/gulp-common-build-tasks)
[![Download Month](https://img.shields.io/npm/dm/gulp-common-build-tasks.svg?style=flat-square)](https://www.npmjs.org/package/gulp-common-build-tasks)

You can found in this library some utilities and tasks that can be shared between multiple gulp's build processes.

## Install
```
npm install gulp-common-build-tasks
```

## Usage
```
var common = require('gulp-common-build-tasks');
```

## common.tasks
This is a wrapper over gulp that gives more functionnalities to it.

### Tasks group
```
var common = require('gulp-common-build-tasks');

var tasks = common.tasks();

module.exports = tasks;
```

### Namespaced tasks group
Namespaced tasks groups will prefix every subtasks under this namespace.

Example: A task named ```.test``` under the namespace ```application``` will create a
gulp task named ```namespace.test```.

#### When a group is created
```
var common = require('gulp-common-build-tasks');

var tasks = common.tasks('namespace');

module.exports = tasks;
```

#### Later
```
tasks.setNamespace('namespace');
```

### Task
```tasks.create(taskName, dependencies?, gulpFunction?)```

```
tasks.create('.aTask', ['.anotherTask'], function(gulp, config) {
    [...]
});
```
#### Task name
If a task name is prefixed with a dot ```.```, like ```.aTask```, it will create a relative task name
based on the namespace.

If the dot ```.``` is not present, it will be considered as a root task name.

This is also real when working with dependencies.

### Import a tasks group
```javascript
tasks.import(require('./anotherTasks'));
```

### Conditionally apply a dependency or an import
If you wrap the dependency name or the ```require()``` with a function you can create tasks based on
the result of this function.
#### Dependencies
```javascript
function someFeatureEnabled(taskName) {
    return function(config) {
        return config.isSomeFeatureEnabled ? taskName : false;
    };
}

tasks.create('.aTask', [someFeatureEnabled('.anotherTask')]);
```

#### Import
```javascript
function someFeatureEnabled(importedTasks) {
    return function(config) {
        return config.isSomeFeatureEnabled ? importedTasks : false;
    };
}

tasks.import(someFeatureEnabled(require('.anotherTask')));
```

## common.scripts
A tasks group that provide two gulp task:
* **.jshint**
* **.jscs**

So you just need to import it in your tasks group with ```tasks.import(common.scripts)```.

## common.config
An utility that fills a config with default values like:
* **projectDirectory**: Finds the current project directory if not already defined
* **jshintEnabled**: Checks if the project has a ```.jshintrc``` file.
* **jscsEnabled**: Checks if the project has a ```.jscsrc``` file.

## Creator
**<NAME>**
{'fraction_non_alphanumeric': 0.15743183817062445, 'fraction_numerical': 0.0, 'mean_word_length': 4.832478632478632, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 8, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2571769', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1007, 'n_words': 311}