forked from thatisuday/ng-image-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (53 loc) · 1.37 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
var
gulp = require('gulp'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
cssmin = require('gulp-cssmin'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps')
gzip = require('gulp-gzip')
;
/*************************************************/
// JavaScript
gulp.task('buildJS', function(){
gulp
.src('./src/js/**/*.js')
.pipe(concat('ng-image-gallery.js'))
.pipe(sourcemaps.init())
.pipe(gulp.dest('./dist'))
.pipe(rename({suffix : '.min'}))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist'))
.pipe(gzip({append:true}))
.pipe(gulp.dest('./dist'))
;
});
// Css / Sass(.scss)
gulp.task('buildCSS', function(){
gulp
.src('./src/sass/**/*.scss')
.pipe(concat('ng-image-gallery.scss'))
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourcemaps.init())
.pipe(gulp.dest('./dist'))
.pipe(rename({suffix : '.min'}))
.pipe(cssmin())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist'))
.pipe(gzip({append:true}))
.pipe(gulp.dest('./dist'))
;
});
// build all
gulp.task('build', ['buildJS', 'buildCSS'], function(){
console.log('Build Success...');
});
// watch all
gulp.task('watch', ['build'], function(){
gulp.watch('./src/js/**/*.js', ['buildJS']);
gulp.watch('./src/sass/**/*.scss', ['buildCSS']);
});