3.0.2 • Published 7 years ago

gulp-gcloud v3.0.2

Weekly downloads
11
License
Unlicense
Repository
github
Last release
7 years ago

gulp-gcloud

Upload files to Google Cloud Storage with Gulp

Install

npm install --save-dev gulp-gcloud

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)
  • credentials Object: 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
  • transformPath Function (optional): pass function to transform upload path if base is not enough
  • metadata Object (optional): specify extra metadata for files
  • metadata.cacheControl String (optional): cache for 1 year, dont change assets, cache on intermediary proxies max-age=315360000, no-transform, public

Example

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

const gulp = require('gulp');
const gcPub = require('gulp-gcloud');
const 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
});
3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.2.0

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago