# DevCode Init
DevCode management for [DevCode's plugins](/README.md). It contains Gulp tasks: [default](/packages/init/lib/tasks/default.js), [build](/packages/init/lib/tasks/build.js), [clean](/packages/init/lib/tasks/clean.js), [watch](/packages/init/lib/tasks/watch.js) and [init-config](/packages/init/lib/tasks/init-config.js).

## Getting started

### Prerequisites
What things you need:
- [Node.js](http://www.nodejs.org) + [npm](http://www.npmjs.com) (already included in Node.js)
- [Gulp](http://www.gulpjs.org)

### How to install
Install it as devDependency:
```
npm install -D @devcode/init
```

### How to use
Include it in `gulpfile.js`:
```js
const gulp = require('gulp')
const init = require('@devcode/init')
const plugins = {
  browserSync: require('@devcode/browser-sync')
}
const env = process.argv.includes('build') ? 'production' : 'development'

init({
  gulp, // required
  env, // required
  plugins: { // required
    reload: [plugins.browserSync],
    assets: [...],
    code: [...],
    static: [...]
  }
})
```

## API
```
init: function (settings: object)
```
The `init` function needs `env` (string 'development' or 'production') and `plugins` which contains four keys: `reload`, `assets`, `code` and `static`. Each key can contain array of plugins. In the Gulp tasks `default` and `build` are plugins kept in the chronological order: `clean`, `[plugins.assets]`, `[plugins.code]`, `[plugins.static]`, and for the `default` task as the last is (`watch`).

## Configuration
- `src: string` - name of the folder with source code
- `dist: string` - name of the folder with distribution code
```js
module.exports = {
  src: 'src',
  dist: 'build'
}
```

## Built with
- [Gulp](https://www.npmjs.com/package/gulp) - the streaming build system
- [gulp-sequence](https://www.npmjs.com/package/gulp-sequence) - runs a series of gulp tasks in order
- [del](https://www.npmjs.com/package/del) - deletes files and folders using globs
- [Prettier](https://www.npmjs.com/package/prettier) - the opinionated code formatter

## Contributing
Please read [CONTRIBUTING.md](/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

## Versioning
We use [SemVer](http://semver.org/) for versioning.

## Authors
* **Matej Mazur** - *Initial work* - [GitHub account](https://github.com/MatejMazur)

See also the list of [contributors](https://github.com/matejmazur/devcode/contributors) who participated in this project.

## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.

## Acknowledgements
- This project was inspired by [Blendid](https://github.com/vigetlabs/blendid)
