-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
40 lines (34 loc) · 1015 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
var gulp = require('gulp');
var rename = require('gulp-rename');
var basswork = require('gulp-basswork');
var minifyCss = require('gulp-minify-css');
var browserify = require('browserify');
var transform = require('vinyl-transform');
var uglify = require('gulp-uglify');
var webserver = require('gulp-webserver');
gulp.task('css', function() {
gulp.src('./src/css/base.css')
.pipe(basswork())
.pipe(gulp.dest('./css'))
.pipe(minifyCss())
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./css'));
});
gulp.task('js', function() {
var browserified = transform(function(filename) {
var b = browserify(filename);
return b.bundle();
});
gulp.src('./src/js/app.js')
.pipe(browserified)
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('./js'));
});
gulp.task('serve', function() {
gulp.src('.')
.pipe(webserver({}));
});
gulp.task('default', ['css', 'js', 'serve'], function() {
gulp.watch(['./src/**/*'], ['css', 'js']);
});