Code Monkey home page Code Monkey logo

gulp-gcloud-publish's Introduction

gulp-gcloud-publish

NPM Build Status Code Coverage Code Quality Dependencies Status

Upload files to Google Cloud Storage with Gulp

Install

npm install --save-dev gulp-gcloud-publish

Usage

First, you need to create your Google Cloud API credentials. Official Docs.

The plugin takes a configuration object with the following keys:

  • bucket String: Name of the bucket where we want to upload the file
  • keyFilename String: Full path to the Google Cloud API keyfile (docs)
  • projectId String: Google Cloud Project ID (docs)
  • base String: base path to use in the bucket, default to /
  • public Boolean (optional): If set to true, marks the uploaded file as public

Example

If you would like to gzip the files, the plugin works best with gulp-gzip.

var gulp = require('gulp');
var gcPub = require('gulp-gcloud-publish');
var gzip = require('gulp-gzip'); // optional

gulp.task('publish', function() {

  return gulp.src('public/css/example.css')
      .pipe(gzip()) // optional
      .pipe(gcPub({
        bucket: 'bucket-name',
        keyFilename: 'path/to/keyFile.json',
        projectId: 'my-project-id',
        base: '/css',
        public: true,        
        metadata: {
            cacheControl: 'max-age=315360000, no-transform, public',
        }
      })); // => File will be uploaded to /bucket-name/css/example.css
});

gulp-gcloud-publish's People

Contributors

albertorestifo avatar bobvanluijt avatar

Watchers

James Cloos avatar Balachander 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.