-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
87 lines (76 loc) · 2.51 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
82
83
84
85
86
87
var gulp = require('gulp');
var concat = require('gulp-concat');
var changed = require('gulp-changed');
var uglify = require ('gulp-uglify');
var rename = require ('gulp-rename');
var csso = require ('gulp-csso');
var inject = require ('gulp-inject');
var paths = {
externalScripts : [
'bower_components/angular/angular.min.js',
'bower_components/angular-aria/angular-aria.min.js',
'bower_components/angular-animate/angular-animate.min.js',
'bower_components/angular-material/angular-material.min.js',
'bower_components/jquery/dist/jquery.min.js',
'bower_components/plyr/dist/plyr.js',
'assets/js/soundcloud-sdk.js'
],
externalStyles : [
'bower_components/angular-material/angular-material.min.css',
'bower_components/plyr/dist/plyr.css'
],
scripts : [
'app/**/*.module.js',
'app/**/*.service.js',
'app/**/*.controller.js'
],
styles : [
'assets/css/*.css'
],
index: 'index.html',
partials: ['app/**/*.html', '!app/index.html'],
destExt: 'dist/ext',
dest:'dist'
};
gulp.task('external-js', function() {
return gulp.src(paths.externalScripts)
.pipe(changed(paths.destExt))
.pipe(gulp.dest(paths.destExt));
});
gulp.task('external-css', function() {
return gulp.src(paths.externalStyles)
.pipe(changed(paths.destExt))
.pipe(gulp.dest(paths.destExt));
});
gulp.task('external', ['external-css','external-js']);
gulp.task('build-js', function() {
return gulp.src(paths.scripts)
.pipe(changed(paths.dest))
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(paths.dest));
});
gulp.task('build-css', function() {
return gulp.src(paths.styles)
.pipe(changed(paths.dest))
.pipe(concat('app.css'))
.pipe(csso())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(paths.dest));
});
gulp.task('build', ['build-js','build-css']);
gulp.task('index',['external','build'], function () {
return gulp.src(paths.index)
.pipe(inject(gulp.src(['dist/ext/angular.min.js','dist/ext/!(angular.min.js)*','assets/js/init-plyr.js','assets/js/init-soundcloud.js','dist/*'], {read: false}), {relative: true}))
.pipe(gulp.dest(''))
});
gulp.task('watch', function(){
gulp.watch(paths.scripts, ['build-js']);
gulp.watch(paths.styles, ['build-css']);
});
gulp.task('default', ['external','build','index','watch']);