-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
55 lines (46 loc) · 1.3 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
52
53
54
55
var gulp = require('gulp');
var react = require('gulp-react');
var stylus = require('gulp-stylus');
var notify = require('gulp-notify');
var webpack = require('webpack');
var Notifier = require('node-notifier');
var concat = require('gulp-concat');
var connect = require('connect');
var myDevConfig = require('./webpack.config.js');
var notify = function (options) {
new Notifier().notify(options);
};
var paths = {
jsx: 'src/app/**/*.jsx',
scripts: 'src/app/**/*.js',
images: '',
stylus: 'src/app/**/*.styl'
};
gulp.task('connect', function () {
var app = connect()
.use(connect.static('public'))
.listen(9002);
});
gulp.task('styles', function () {
gulp.src(paths.stylus)
.pipe(stylus())
.pipe(concat('main.css'))
.pipe(gulp.dest('public/css'));
});
gulp.task('webpack:build-dev', function (callback) {
var devCompiler = webpack(myDevConfig);
devCompiler.run(function(err, stats) {
if(err) throw new gutil.PluginError("webpack:build-dev", err);
callback();
});
});
gulp.task("watch-app", function() {
gulp.watch(["src/app/**/*", "src/app/**/*"], ["build-app"]);
});
gulp.task("build-app", ["webpack:build-dev", "styles"], function () {
notify({
title: 'Gulp Build',
message: 'App was built'
});
});
gulp.task('default', ['connect', 'build-app', 'watch-app']);