-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
79 lines (70 loc) · 1.86 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');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var rename = require('gulp-rename');
var header = require('gulp-header');
var pkg = require('./version.json');
var banner = ['/**',
' * @name <%= pkg.name %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.link %>',
' */',
''].join('\n');
// We only want to process our own non-processed JavaScript files.
var jsPaths = [
'Resources/public/app/fakeOffline.js',
'Resources/public/app/app.js',
'Resources/public/app/*.js'
];
var jsAssetPaths = [
'Resources/public/assets/lib/jquery-*.min.js',
'Resources/public/assets/lib/angular.min.js',
'Resources/public/assets/lib/*.js'
];
var adminBuildDir = 'Resources/public/assets/build';
var jsAdminPaths = [
'Resources/public/apps/**/**/**/*.js'
];
/**
* Run Javascript through JSHint.
*/
gulp.task('jshint', function() {
return gulp.src(jsPaths)
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
/**
* Build single app.js file.
*/
gulp.task('js', function (done) {
gulp.src(jsPaths)
.pipe(concat('app.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename({extname: ".min.js"}))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest(adminBuildDir));
gulp.src(jsAdminPaths)
.pipe(concat('os2displayscreen.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename({extname: ".min.js"}))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest(adminBuildDir));
done();
});
/**
* Build single assets.js file.
*/
gulp.task('assets', function (done) {
gulp.src(jsAssetPaths)
.pipe(concat('assets.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename({extname: ".min.js"}))
.pipe(gulp.dest(adminBuildDir));
done();
});