Install & configure gulp

This commit is contained in:
Bea 2020-11-06 17:49:14 +01:00
parent e899839211
commit e2f0f4bc81
2 changed files with 47 additions and 0 deletions

35
gulpfile.js Normal file
View File

@ -0,0 +1,35 @@
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const pump = require('pump');
const zip = require('gulp-zip');
function js(done) {
pump([
gulp.src('assets/js/*.js', {sourcemaps: true}),
uglify(),
gulp.dest('assets/built/', {sourcemaps: '.'})
], done());
}
exports.js = js;
function zipper(done) {
var targetDir = 'dist/';
var themeName = require('./package.json').name;
var filename = themeName + '.zip';
pump([
gulp.src([
'**',
'!node_modules', '!node_modules/**',
'!dist', '!dist/**',
'!*.ignore',
'!gulpfile.js',
'!package-lock.json'
]),
zip(filename),
gulp.dest(targetDir)
], done());
}
exports.zip = zipper;

View File

@ -38,5 +38,17 @@
"width": 2000
}
}
},
"devDependencies": {
"gulp": "^4.0.2",
"gulp-uglify": "^3.0.2",
"pump": "^3.0.0"
},
"scripts": {
"js": "gulp js",
"zip": "gulp zip"
},
"dependencies": {
"gulp-zip": "^5.0.2"
}
}