gulpfile.js
1.52 KB
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
const templateCache = require('gulp-angular-templatecache');
const concat = require('gulp-concat');
const clean = require('gulp-clean');
const htmlmin = require('gulp-htmlmin');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify-es').default;
const gulp = require('gulp');
const pump = require('pump');
const jshint = require('gulp-jshint');
var paths = {
srcJS: 'src/js/*.js',
srcViews: 'src/views/*.html',
tmp: 'tmp',
dist: 'dist/'
};
gulp.task('templates', function() {
return pump(
[
gulp.src(paths.srcViews),
htmlmin(),
templateCache('views.js', {
module: 'focaAbmPlazoPago',
root: ''
}),
gulp.dest(paths.tmp)
]
);
});
gulp.task('uglify', ['templates'], function() {
return pump(
[
gulp.src([
paths.srcJS,
'tmp/views.js'
]),
concat('foca-abm-plazo-pago.js'),
gulp.dest(paths.tmp),
rename('foca-abm-plazo-pago.min.js'),
uglify(),
gulp.dest(paths.dist)
]
);
});
gulp.task('clean', function(){
return gulp.src(['tmp', 'dist'], {read: false})
.pipe(clean());
});
gulp.task('pre-commit', function() {
pump(
[
gulp.src(paths.srcJS),
jshint('.jshintrc'),
jshint.reporter('default'),
jshint.reporter('fail')
]
);
});