Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iguntur/mild-config
:warning: [DEPRECATED] - Mild config for gulp
https://github.com/iguntur/mild-config
Last synced: about 12 hours ago
JSON representation
:warning: [DEPRECATED] - Mild config for gulp
- Host: GitHub
- URL: https://github.com/iguntur/mild-config
- Owner: iguntur
- License: mit
- Created: 2016-11-02T21:44:55.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-18T08:29:23.000Z (almost 8 years ago)
- Last Synced: 2024-10-31T18:59:32.082Z (7 days ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mild-config [![Build Status](https://travis-ci.org/iguntur/mild-config.svg?branch=master)](https://travis-ci.org/iguntur/mild-config)
> Mild config for gulp
Make easy and simple to setup __[gulp](https://www.npmjs.com/package/gulp)__ config tasks.
### Requirement
- __Node 4+__
## Install
``` bash
$ npm install --save mild-config
```## Usage
``` js
const gulp = require('gulp');
const webpack = require('webpack-stream');
const sass = require('gulp-sass');
const config = require('mild-config');gulp.task('script', () => {
return gulp.src(config.src('js/*.js'))
.pipe(webpack(config.get('plugins.webpack')))
.pipe(gulp.dest(config.dest('js')));
});gulp.task('sass', () => {
return gulp.src(config.src('sass/**/*.scss'))
.pipe(sass(config.get('plugins.sass')))
.pipe(gulp.dest(config.dest('css')));
});
```## API
> Also See [dot-prop](https://www.npmjs.com/package/dot-prop#api) API
### config.Mild(options)
Returns a new instance
#### options
Type: `object`
- __default__
Type: `object`Default config.
#### Instance
- __.set(key, value)__
Set an item.
- __.set(object)__
Set multiple items at once.
- __.get(key)__
Get an item.
- __.has(key)__
Check if an item exists.
- __.delete(key)__
Delete an item.
- __.clear()__
Delete all items.
- __.src(path)__
Return the `path` and include with prefix path `'resources/assets'`,
ensure the `path` does not begin with `'/'`, `'./'`, `'../'`.__path__
Type: `string`, `array`__Example__
``` js
const config = require('mild-config');config.src('js/*.js');
//=> 'resources/assets/js/*.js'config.src('./_assets/js/*.js');
//=> './_assets/js/*.js'config.src(['js/*.js', '!js/vendor/**']);
//=> ['resources/assets/js/*.js', '!resources/assets/js/vendor/**']config.src(['js/*.js', '!./node_modules/**']);
//=> ['resources/assets/js/*.js', '!./node_modules/**']
```- __.dest(folder)__
Return the `folder` and include with prefix path `'public/assets'`,
ensure the `folder` does not begin with `'/'`, `'./'`, `'../'`.__folder__
Type: `string`Set your folder destination
__Example__
``` js
const config = require('mild-config');config.dest('css');
//=> 'public/assets/css'config.dest('./public/css');
//=> './public/css'
```- __.join([...paths])__
Returns path using __[path.join](https://nodejs.org/api/path.html#path_path_join_paths)__
__paths__
Type: `string`__Example__
``` js
const config = require('mild-config');config.join('basePath', 'assetsPath', 'gulp.src.js', 'foo.js');
//=> 'resources/assets/scripts/foo.js'var path = config.join('basePath', 'assetsPath', 'gulp.src.js', 'foo.js');
config.join('publicPath', 'assetsPath', 'gulp.dest.js');
//=> 'public/assets/js'
```## Related
- [dot-prop](https://github.com/sindresorhus/dot-prop) - API for this module (Get, set, or delete a property from a nested object using a dot path)
## License
MIT © [Guntur Poetra](http://guntur.starmediateknik.com)