-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
44 lines (39 loc) · 934 Bytes
/
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
'use strict'
const gulp = require('gulp')
const source = require('vinyl-source-stream')
const nodemon = require('gulp-nodemon')
const babel = require('gulp-babel')
const stylus = require('gulp-stylus')
const sourcemaps = require('gulp-sourcemaps')
const browserify = require('browserify')
const babelify = require('babelify')
gulp.task('default', ['watch'])
gulp.task('watch', ['css', 'js'], function() {
nodemon({
script: 'index.js',
ext: 'html js styl',
ignore: ['dist/*', 'uploads/*'],
tasks: ['css', 'js']
})
})
gulp.task('css', function() {
return gulp.src('src/style.styl')
.pipe(sourcemaps.init())
.pipe(stylus({
compress: true
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'))
})
gulp.task('js', function() {
return browserify({
entries: 'src/index.js',
debug: true
})
.transform(babelify, {
presets: ['es2016-node5']
})
.bundle()
.pipe(source('index.js'))
.pipe(gulp.dest('dist'))
})