-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
72 lines (59 loc) · 1.89 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var connect = require('gulp-connect');
var inject = require('gulp-inject');
var series = require('stream-series');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
/** browserify
var browserify = require('browserify');
var source = require('vinyl-source-stream');
*/
var bowerFiles = require('main-bower-files');
gulp.task('connect', function () {
connect.server({
root: '',
port: 4014
});
});
gulp.task('styles', function () {
gulp.src('./app/styles/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./app/styles/'))
});
gulp.task('index', function () {
var target = gulp.src('./app/index.html');
var sources = gulp.src(['./app/**/*.js', './app/**/*.css'], {
read: false
});
var bowerSources = gulp.src(bowerFiles(), {
read: false
});
var othersBowerSources = gulp.src(["bower_components/angular/angular.min.js", "bower_components/material-angular-paging/build/dist.min.js"]);
return target
.pipe(inject(series(othersBowerSources, sources),{
addRootSlash: false
}))
.pipe(inject(bowerSources, {
name: 'bower',
addRootSlash: false
}, {
relative: true
}))
.pipe(gulp.dest(''));
});
gulp.task('minify', function () {
gulp.src(['app/**/*.js'])
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(gulp.dest(''));
});
gulp.task('watch', function () {
gulp.watch('app/**/*.js', ['index']);
gulp.watch('app/**/*.html', ['index']);
gulp.watch('app//styles/**/*.scss', ['styles']);
});
gulp.task('browserify', function () {
});
gulp.task('default', ['styles', 'index', 'connect', 'watch']);
gulp.task('release', ['styles', 'index', 'minify']);