-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
75 lines (68 loc) · 2.9 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
var gulp = require('gulp')
var uglify = require('gulp-uglify')
var stylus = require('gulp-stylus')
var gulpUtil = require('gulp-util')
var amdOptimize = require('amd-optimize')
var concat = require('gulp-concat')
var ngAnnotate = require('gulp-ng-annotate')
gulp.task('buildlibs', function() {
//lots of manual configs here but every package has its own standards...
//only leave css and fonts for the minified build
gulp.src([
//'bower_components/**/*.min.js',
//'bower_components/**/*-min.js',
'bower_components/**/*.min.css',
'bower_components/**/*.png',
'bower_components/**/*.eot',
'bower_components/**/*.ttf',
'bower_components/**/*.svg',
'bower_components/**/*.woff*',
], {base: 'bower_components'}).pipe(gulp.dest('build/app/lib'))
gulp.src('bower_components/requirejs/require.js')
.pipe(uglify())
.pipe(gulp.dest('build/app/lib'))
})
gulp.task('copystatics', function() {
gulp.src(['src/index.html', 'src/img/**', 'src/css/fonts/**'], {base: 'src'})
.pipe(gulp.dest('build/app'))
})
gulp.task('buildcss', function() {
gulp.src(['src/css/*.styl'], {base: 'src'})
.pipe(stylus({compress: true}))
.pipe(gulp.dest('build/app'))
})
gulp.task('buildjs', function() {
//uncomment annotation, minification and concatenation for the minified build
gulp.src(['src/js/**/*.js'], {base: 'src'})
.pipe(ngAnnotate({add: true}))
.pipe(amdOptimize('main', {
baseUrl: 'src/js',
configFile: 'src/js/require.config.js',
findNestedDependencies: true,
//dubious organization but it will suffice for now
paths: {
'jquery': '../../bower_components/jquery/dist/jquery.min',
'angular': '../../bower_components/angular/angular.min',
'angular-ui-router': '../../bower_components/angular-ui-router/release/angular-ui-router.min',
'bootstrap': '../../bower_components/bootstrap/dist/js/bootstrap.min',
'underscore': '../../bower_components/underscore/underscore-min',
'datatables.net': '../../bower_components/datatables.net/js/jquery.dataTables.min',
'datatables.net-bs': '../../bower_components/datatables.net-bs/js/dataTables.bootstrap.min',
'datatables.net-buttons': '../../bower_components/datatables.net-buttons/js/dataTables.buttons.min',
'angular-ui-select': '../../bower_components/angular-ui-select/dist/select.min',
'angular-sanitize': '../../bower_components/angular-sanitize/angular-sanitize.min',
'angular-resource': '../../bower_components/angular-resource/angular-resource.min',
'angular-cookies': '../../bower_components/angular-cookies/angular-cookies.min'
}
}))
.pipe(concat('js/main.js'))
.pipe(uglify({mangle: {except: ['Global']}}).on('error', gulpUtil.log))
.pipe(gulp.dest('build/app'))
gulp.src(['src/js/**/*.html'], {base: 'src'})
.pipe(gulp.dest('build/app'))
})
gulp.task('default', function() {
gulp.watch('src/css/**', ['buildcss'])
gulp.watch('src/js/**', ['buildjs'])
gulp.watch(['src/index.html', 'src/img/**'], ['copystatics'])
});