-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (56 loc) · 1.6 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglify');
var clean = require('gulp-clean');
/*
* Default task does the following:
* - Copies files to ./bin folder
* - Concats and minifies scripts
* - Cleans original scripts
*
* Dependencies: clean-scripts -> compress -> annotate -> copy
*/
gulp.task('default', ['clean-scripts']);
gulp.task('copy', function(){
return gulp.src('src/**/*.*')
.pipe(gulp.dest('bin'));
});
gulp.task('annotate', ['copy'], function () {
return gulp.src('bin/**/*.js')
.pipe(ngAnnotate())
.pipe(gulp.dest('bin'));
});
gulp.task('compress', ['annotate'], function() {
//concat module files first so that they are available later
//concat other js files then (concat shouldnt include same file twice)
var files = [
'bin/app/app.module.js',
'bin/app/**/*.module.js',
'bin/app/**/*.js'
]
return gulp.src(files)
.pipe(concat('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest('bin/app'))
});
gulp.task('clean-scripts', ['compress'], function () {
var files = [
'bin/app/**/*.js',
'!bin/app/app.min.js',
]
return gulp.src(files, {read: false})
.pipe(clean());
});
/*
* If dcent-patterns project is cloned to another folder and updated, these can be used to update
* the css to use in mockups
*/
gulp.task('updatecss', function() {
return gulp.src('../dcent-patterns/source/assets/css/main.css')
.pipe(gulp.dest('src/assets/css/'));
});
gulp.task('updateimg', function(){
return gulp.src('../dcent-patterns/source/assets/img/*')
.pipe(gulp.dest('src/assets/img/'));
});