Giter VIP home page Giter VIP logo

gulp-storage's Introduction

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

gulp-storage's People

Contributors

joelcoxokc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.