-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
59 lines (49 loc) · 1.44 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
56
57
58
59
var path = require('path');
global.gulp = require('gulp');
var webserver = require('gulp-webserver');
var browserify = require('gulp-browserify');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var reactify = require('reactify');
var babel = require('gulp-babel');
global.flariorPaths = {
app : path.resolve('./app/'),
sass : path.resolve('./app/sass'),
sassGlob: path.resolve('./app/sass/**/*.scss'),
javascript: path.resolve('./app/js/**/*.js*'),
jsxEntry: path.resolve('./app/js/app.jsx'),
backend: path.resolve('./app/livereload.txt'),
css: path.resolve('./app/css')
}
gulp.task('webserver',['sass', 'watch', 'compileJs', 'backend'], function() {
gulp.src(flariorPaths.app)
.pipe(webserver({
host: '0.0.0.0',
port: 8000,
livereload: true
}));
});
gulp.task('sass', function compileInuit(){
gulp.src(flariorPaths.sassGlob)
.pipe(sass({
errLogToConsole: true
}))
.pipe(gulp.dest('./app/static/css'))
});
gulp.task('compileJs', function(){
gulp.src(flariorPaths.jsxEntry)
.pipe(browserify({
transform: [reactify]
}))
.pipe(babel())
.pipe(rename('app.js'))
.pipe(gulp.dest('./app/static/js'))
});
gulp.task('backend', function() {
});
gulp.task('watch', function(){
gulp.watch(flariorPaths.sassGlob, ['sass']);
gulp.watch(flariorPaths.javascript, ['compileJs']);
gulp.watch(flariorPaths.backend, ['backend']);
});
gulp.task('default', ['webserver']);