-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
79 lines (74 loc) · 2.53 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var gulp = require('gulp'),
less = require('gulp-less'),
prefix = require('gulp-autoprefixer'),
minCSS = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
docco = require('gulp-docco'),
zip = require('gulp-zip');
// Compile LESS.
gulp.task('less', function () {
return gulp.src('src/OnDemandSuiteWP/Assets/less/*.less')
.pipe(less())
.pipe(prefix('last 2 versions'))
.pipe(minCSS())
.pipe(gulp.dest('src/OnDemandSuiteWP/Assets/less/dist/'));
});
// Build JS.
gulp.task('js', function () {
return gulp.src('src/OnDemandSuiteWP/Assets/js/*.js')
.pipe(uglify({
mangle: false
}))
.pipe(gulp.dest('src/OnDemandSuiteWP/Assets/js/dist/'));
});
// Build JS source code annotations.
gulp.task('docs', function () {
gulp.src('src/OnDemandSuiteWP/Assets/js/*.js')
.pipe(docco())
.pipe(gulp.dest('./docs/js/'));
});
// Make distribution.
gulp.task('dist', ['less', 'js'], function () {
gulp.src([
'./src/**/*.*',
'./vendor/angular/angular.min.js',
'./vendor/angular/angular.min.js.map',
'./vendor/angular-animate/angular-animate.min.js',
'./vendor/angular-animate/angular-animate.min.js.map',
'./vendor/composer/**/*.*',
'./vendor/fontawesome/css/font-awesome.min.css',
'./vendor/fontawesome/fonts/**/*.*',
'./vendor/lodash/dist/lodash.compat.min.js',
'./vendor/ng-file-upload/angular-file-upload-shim.min.js',
'./vendor/ng-file-upload/angular-file-upload.min.js',
'./vendor/ngModal/dist/ng-modal.css',
'./vendor/ngModal/dist/ng-modal.min.js',
'./vendor/autoload.php',
'./LICENSE',
'./HP_IDOL_OnDemand_Suite_For_WP.php',
'./readme.txt'
], {
base: './'
})
.pipe(zip('HP_IDOL_OnDemand_Suite_For_WP.zip'))
.pipe(gulp.dest('./dist'));
});
// Dev mode.
gulp.task('dev', function () {
// js
gulp.watch('src/OnDemandSuiteWP/Assets/js/*.js', function (e) {
gulp.src(e.path)
.pipe(gulp.dest('src/OnDemandSuiteWP/Assets/js/dist/'));
}).on('change', function (event) {
console.log('Changed:' + event.path);
});
// less
gulp.watch('src/OnDemandSuiteWP/Assets/less/*.less', function (e) {
gulp.src(e.path)
.pipe(less())
.pipe(prefix('last 2 versions'))
.pipe(gulp.dest('src/OnDemandSuiteWP/Assets/less/dist/'));
}).on('change', function (event) {
console.log('Changed:' + event.path);
});
});