-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (50 loc) · 1.64 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
var gulp = require('gulp');
var gulpif = require('gulp-if');
var argv = require('yargs').argv;
var concat = require('gulp-concat');
var ngAnnotate = require('gulp-ng-annotate');
var templateCache = require('gulp-angular-templatecache');
var autoprefixer = require('gulp-autoprefixer');
var sass = require('gulp-sass');
var csso = require('gulp-csso');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber');
gulp.task('sass', function() {
return gulp.src('public/css/main.scss')
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer())
.pipe(gulpif(argv.production, csso()))
.pipe(gulp.dest('public/css'));
});
gulp.task('angular', function() {
return gulp.src([
'app/app.js',
'app/controllers/*.js',
'app/services/*.js'
])
.pipe(concat('application.js'))
.pipe(ngAnnotate())
.pipe(gulpif(argv.production, uglify()))
.pipe(gulp.dest('public/js'));
});
gulp.task('templates', function() {
return gulp.src('app/partials/**/*.html')
.pipe(templateCache({ root: 'partials', module: 'MyApp' }))
.pipe(gulpif(argv.production, uglify()))
.pipe(gulp.dest('public/js'));
});
gulp.task('vendor', function() {
return gulp.src('app/vendor/*.js')
.pipe(gulpif(argv.production, uglify()))
.pipe(gulp.dest('public/js/lib'));
});
gulp.task('watch', function() {
gulp.watch('public/css/**/*.scss', ['sass']);
gulp.watch('app/views/**/*.html', ['templates']);
gulp.watch('app/**/*.js', ['angular']);
});
gulp.task('build', ['sass', 'angular', 'vendor', 'templates']);
gulp.task('default', ['build', 'watch']);