-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathGulpfile.js
51 lines (41 loc) · 1.06 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
51
/* jshint node:true*/
'use strict';
var browserify = require('browserify');
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
gulp.task('build', ['js', 'css']);
gulp.task('default', ['build']);
gulp.task('js', function() {
var b = browserify({
entries: './app.js',
debug: true,
});
return b.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe($.rename('bundle.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('css', function() {
var HIGHLIGHT_JS_THEME = 'monokai';
return gulp.src([
'node_modules/highlight.js/styles/' + HIGHLIGHT_JS_THEME + '.css',
'app.css'
])
.pipe($.concatCss("bundle.css"))
.pipe(gulp.dest('dist/'));
});
gulp.task('test', ['watch'], function() {
gulp.src('./')
.pipe($.webserver({
fallback: 'index.html',
livereload: true,
open: true
}));
});
gulp.task('watch', ['build'], function() {
gulp.watch('./app.js', ['js']);
gulp.watch('./app.css', ['css']);
});