Install & configure gulp
This commit is contained in:
parent
e899839211
commit
e2f0f4bc81
35
gulpfile.js
Normal file
35
gulpfile.js
Normal 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;
|
12
package.json
12
package.json
@ -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"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user