-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (41 loc) · 1 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
var gulp = require('gulp')
, sass = require('gulp-sass')
, browserSync = require('browser-sync').create()
, sourcemaps = require('gulp-sourcemaps')
, uglify = require('gulp-uglify')
, rename = require('gulp-rename')
, jsdoc = require('gulp-jsdoc3')
;
gulp.task('watch', ['browserSync', 'sass', 'doc', 'build-js'], function(){
gulp.watch('scss/**/*.scss', ['sass']);
gulp.watch('src/**/*.js', ['doc', 'build-js']);
// Other watchers
})
gulp.task('sass', function(){
return gulp.src('scss/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('css'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: ''
},
})
})
gulp.task('build-js', function() {
return gulp.src('src/**/*.js')
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist/'));
});
gulp.task('doc', function (cb) {
var config = require('./jsdoc.json');
gulp.src(['README.md', 'src/**/*.js'], {read: false})
.pipe(jsdoc(config, cb));
});