JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 542
  • Score
    100M100P100Q91062F
  • License MIT

A plugin for Gulp

Package Exports

  • gulp-storage

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-storage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

(PLUGIN AUTHOR: Please read Plugin README conventions, then delete this line)

gulp-storage

storage plugin for gulp

Features

  • Gulp Storage uses Yeoman-Generator's storage plugin to simply save co nfigurations in a local JSON file.
  • Bind's a storage property 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:

// Do this
var storage = require('gulp-storage');
// or do this
require('gulp-storage')

gulp.storage.create('SomeName', 'somName.json');

gulp.task( 'any', ['anotherTask'] function(){
    var appName = this.storage.get('appName');
    console.log(appName)
    //=> myApp
});

gulp.task('anotherTask', function(){
    this.storage.set('appName', 'myApp');
});

API

storage.create( name, fileName );

name

Type: String
Default: myApp Required: true

The the name will be the root object property for anything set in your storage.

fileName

Type: String Default: myApp.json Required: true extension: .json

The Storage will create a Json file, using the specified name;

storage.set( key, value );

key

Type: String Required: true

value

Type: String
Required: true

storage.set will set a new property in your json local storage file.

storage.get( key );

key

Type: String Required: false

storage.get will retreive values from your local json storage file.

  • You can pass a key property to get a specific value.
  • If no key is specified, storage.get will return the everything in your local storage file.

storage.store( object );

object

Type: Object Required: true

storage.store will storage 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

License

MIT License