forked from os2display/screen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
81 lines (72 loc) · 1.85 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
80
81
var argv = require('yargs').argv;
var gulp = require('gulp');
// Plugins.
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var rename = require('gulp-rename');
var gulpif = require('gulp-if');
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 = [
'./app/app.js',
'!./app/config.js',
'!./app/example.config.js',
'./app/**/**/**/*.js'
];
var jsAssetPaths = [
'./assets/lib/jquery-*.min.js',
'./assets/lib/angular-1.*.min.js',
'./assets/lib/*.js',
'./assets/modules/**/*.js'
];
var adminBuildDir = './assets/build';
/**
* 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 () {
gulp.src(jsPaths)
.pipe(concat('app.js'))
.pipe(ngAnnotate())
.pipe(gulpif(argv.production, uglify()))
.pipe(rename({extname: ".min.js"}))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest(adminBuildDir))
});
/**
* Build single assets.js file.
*/
gulp.task('assets', function () {
gulp.src(jsAssetPaths)
.pipe(concat('assets.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename({extname: ".min.js"}))
.pipe(gulp.dest(adminBuildDir))
});
/**
* Watch files for changes and run tasks.
*/
gulp.task('default', function() {
gulp.watch(jsPaths, ['js']);
gulp.watch(jsAssetPaths, ['assets']);
});