JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 611
  • Score
    100M100P100Q90739F
  • 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

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 gulp
var gulp = require('gulp');

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

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

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 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

License

MIT License