Skip to content

Instantly share code, notes, and snippets.

@elconejito
Created February 20, 2015 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elconejito/de08f0d4fb4a62879d67 to your computer and use it in GitHub Desktop.
Save elconejito/de08f0d4fb4a62879d67 to your computer and use it in GitHub Desktop.
This is a partial for a gulp file to zip up a folder conforming to WordPress requirements.
var gulp = require('gulp'),
zip = require('gulp-zip'),
pkg = require('./package.json');
var zipDirs = [
'*.*',
'foldertoinclude/**',
'!filetobeignored.txt'
];
/**
* Creates a zip file to distribute the stage extension
*
* base option of gulp.src uses '../' to go up one level so the packaged zip has the folder name inside the zip
* per WordPress theme zip requirements.
*/
gulp.task('zip', function() {
return gulp.src(zipDirs, { base: "../" })
.pipe(zip(pkg.name + '-' + pkg.version + '.zip'))
.pipe(gulp.dest('./dist'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment