-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
78 lines (69 loc) · 2.93 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var es = require('event-stream');
var cleanCSS = require('gulp-clean-css');
var runSequence = require('run-sequence');
gulp.task('clean', function () {
return gulp.src('dist/')
.pipe(clean());
});
gulp.task('lastClean', ['copy'], function () {
return gulp.src('dist/include/*/js')
.pipe(clean());
});
gulp.task('jshint', function () {
return gulp.src(['js/**/*.js', 'include/*/js/**/*.js', 'themes/intranet/'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
//'include/*/js/**/*.app.js', 'include/*/js/**/*.value.js', 'include/*/js/**/*.services.js', 'include/*/js/**/*.ctrl.js']
gulp.task('uglify', ['clean'], function () {
return es.merge([
gulp.src('_lib/**/*.min.js')
.pipe(concat('lib.min.js')),
gulp.src(['js/*.js', 'js/jquery/**/*.js', 'js/google-charts/start.js', 'js/google-charts/*.charts.js',
'js/angular/**/*.module.js', 'js/angular/**/*.directive.js', 'js/angular/**/*.filter.js', 'js/angular/**/*.services.js'])
.pipe(uglify({mangle: false}))
.pipe(concat('all.min.js')),
gulp.src('include/*/js/**/*.js')
.pipe(uglify({mangle: false}))
.pipe(concat('plugins.min.js'))
])
.pipe(gulp.dest('dist/js'));
});
//htmlmin pode ser implementado.
gulp.task('cssmin', function () {
return es.merge([
gulp.src('_lib/bootstrap/css/bootstrap.css')
.pipe(cleanCSS())
.pipe(concat('bootstrap.min.css')),
gulp.src('_lib/angular/css/ng-animation.css')
.pipe(cleanCSS())
.pipe(concat('ng-animation.min.css'))
])
.pipe(gulp.dest('dist/css'));
});
gulp.task('copy', function () {
return es.merge([
gulp.src('_app/**').pipe(gulp.dest('dist/_app')),
gulp.src('_lib/cdn/**').pipe(gulp.dest('dist/cdn')),
gulp.src('_lib/bootstrap/fonts/**').pipe(gulp.dest('dist/fonts')),
gulp.src('_lib/bootstrap/css/bootstrap-*.css').pipe(gulp.dest('dist/css')),
gulp.src('admin/**').pipe(gulp.dest('dist/admin')),
gulp.src('api/**').pipe(gulp.dest('dist/api')),
gulp.src('api/.htaccess').pipe(gulp.dest('dist/api')),
gulp.src('ftp/images/**').pipe(gulp.dest('dist/ftp/images')),
gulp.src('include/**').pipe(gulp.dest('dist/include')),
gulp.src('themes/**').pipe(gulp.dest('dist/themes')),
// gulp.src('uploads/**').pipe(gulp.dest('dist/uploads')),
gulp.src('css/**').pipe(gulp.dest('dist/css')),
gulp.src('.htaccess').pipe(gulp.dest('dist/')),
gulp.src('*.php*').pipe(gulp.dest('dist/'))
]);
});
gulp.task('default', function (cb) {
return runSequence('clean', ['jshint', 'uglify', 'cssmin', 'lastClean'], cb);
});