gulp-storage
storage plugin for gulp
Features
- Gulp Storage uses Yeoman-Generator's storage plugin to simply save configurations in a local JSON file.
- Bind's a storage property to the the gulp instance.
- Within any gulp task, you can access the storage property by calling this.storage.
Usage
First, install gulp-storage
as a development dependency:
npm install --save-dev gulp-storage
Then, add it to your gulpfile.js
:
// require gulpvar gulp = ; // Do thisvar storage = gulp; // or do thisgulp; gulpstorage; gulp; gulp;
API
storage.create( name, fileName );
name
- Type:
String
- Default:
myApp
- Required:
true
The name
property will be the root object key for anything set in your local storage file.
fileName
- Type:
String
- Default:
myApp.json
- Required:
true
- extension:
.json
The gulp-storage will create a Json file in your local directory, using the specified name;
Note If you are using gulp-storage with a SlushJS Generator, gulp-storage will create the json
file in the generated directory.
The path will be process.cwd();
storage.set( key, value );
key
Type: String
Required: true
value
Type: String
Required: true
storage.set will set a new property in your local storage file.
storage.get( key );
key
Type: String
Required: false
storage.get will retreive values from your local storage file.
- You can pass a key property to get a specific value.
- If no key is specified, storage.get will return everything in your local storage file.
storage.store( object );
object
Type: Object
Required: true
storage.store will set all properties and values within the object in your local storage file.
TODO
- Create a storage.clear();
// Delete everything
- Create a storage.delete( key );
// Delete a specific property