-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
50 lines (44 loc) · 1.01 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
var
gulp = require('gulp'),
browserify = require('browserify'),
watch = require('gulp-watch'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
del = require( 'del'),
uglify = require('gulp-uglify')
;
gulp.task( 'watch', function()
{
watch( 'sass/**/*.scss', function()
{
gulp.start( 'sass' );
} );
watch( 'js/app.js', function()
{
gulp.start( 'build-site' );
} );
watch( 'src/**/*.js', function()
{
gulp.start( 'build-site' );
} );
} );
gulp.task( 'sass', function() {
return gulp.src( 'sass/**/*.scss' )
.pipe( sass() )
.pipe( autoprefixer( 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1' ) )
.pipe( gulp.dest( 'style' ) )
;
} );
gulp.task( 'build-site', function() {
return browserify( 'js/app.js')
.bundle()
.pipe( source( 'build.js' ) )
.pipe( gulp.dest( 'js' ) )
.pipe( buffer() )
.pipe( uglify() )
.pipe( gulp.dest( 'js' ) )
;
} );
gulp.task( 'default', [ 'watch' ] );