-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
76 lines (67 loc) · 2.12 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
var gulp = require('gulp'),
styles = require('gulp-sass'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
plumber = require('gulp-plumber'),
htmlmin = require('gulp-htmlmin'),
uglifycss = require('gulp-uglifycss'),
minifyCss = require('gulp-minify-css'),
ngAnnotate = require('gulp-ng-annotate'),
watcher = gulp.watch(['./main/**/*.js', './main/css/*.scss', './main/**/*.html'], ['default']);
watcher.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ' at ' + new Date() + ' , running tasks...');
});
//browser sync to get live server like features with gulp
gulp.task('styles', function() {
return gulp.src('./main/**/*.scss')
.pipe(styles())
.pipe(minifyCss())
.pipe(plumber())
.pipe(concat('style.css'))
.pipe(rename({
basename : 'style',
extname : '.min.css'
}))
.pipe(gulp.dest('./docs/styles'))
});
gulp.task('javascript', function() {
return gulp.src(['./main/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(ngAnnotate())
.pipe(plumber())
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(rename({
basename : 'all',
extname : '.min.js'
}))
.pipe(gulp.dest('./docs/scripts'))
});
gulp.task('vendor', function() {
return gulp.src([
// './bower_components/angular/angular.js',
// './bower_components/angular-ui-router/release/angular-ui-router.js',
// './bower_components/jquery/dist/jquery.js',
'./node_modules/image-loader-angular/js/image-loader.js'
])
// .pipe(jshint())
// .pipe(jshint.reporter('default'))
.pipe(ngAnnotate())
.pipe(plumber())
.pipe(concat('vendor.js'))
.pipe(uglify())
.pipe(rename({
basename : 'vendor',
extname : '.min.js'
}))
.pipe(gulp.dest('./docs/scripts'))
});
gulp.task('html', function() {
return gulp.src('./main/**/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./docs/html'))
});
gulp.task('default', ['styles', 'javascript', 'vendor', 'html']);