-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathgulpfile.js
41 lines (36 loc) · 1.11 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
var gulp = require('gulp'),
browserSync = require('browser-sync'),
sass = require('gulp-sass'),
prefix = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename');
gulp.task('serve', ['sass', 'dist'], function() {
browserSync.init({
server: {
baseDir: "./"
},
open: false,
online: false,
notify: false
});
gulp.watch('scss/**', ['sass']);
gulp.watch('js/jelly.js', ['dist']);
gulp.watch(['*.html', 'js/**', 'dist/**']).on('change', browserSync.reload);
});
gulp.task('sass', function () {
return gulp.src('scss/**')
.pipe(sass({
outputStyle: 'expanded',
includePaths: ['scss']
}))
.pipe(prefix(['last 15 versions'], { cascade: true }))
.pipe(gulp.dest('css'))
.pipe(browserSync.reload({stream:true}));
});
gulp.task('dist', function(){
return gulp.src('js/jelly.js')
.pipe(uglify({preserveComments: 'some'}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('js'));
});
gulp.task('default', ['serve']);