This repository has been archived by the owner on May 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
69 lines (59 loc) · 1.73 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
60
61
62
63
64
65
66
67
68
69
const gutil = require('gulp-util');
const sass = require('gulp-sass');
const gulp = require('gulp');
const config = require('./config');
const prod = config.environment.type == 'prod';
process.env.NODE_ENV = prod ? 'production' : config.environment.type;
gulp.task('css', () =>
gulp.src('./client/styles/style.css')
.pipe(
sass({ outputStyle: 'compressed' }).on('error', sass.logError)
)
.pipe(gulp.dest('./static/css'))
);
gulp.task('client', () => {
const browserify = require('browserify');
const streamify = require('gulp-streamify');
const babelify = require('babelify');
const uglify = require('gulp-uglify');
const source = require('vinyl-source-stream');
const extensions = ['.jsx', '.js'];
const b = browserify(
'./client/components/App.jsx', {
debug: true, extensions, paths: ['./client']
}
);
b.transform(babelify.configure({
extensions, presets: ['es2015', 'react']
}));
return b.bundle()
.pipe(source('App.js'))
.pipe(
prod ? streamify(uglify({
mangle: false,
compress: { unused: false }
}))
.on('error', gutil.log) : gutil.noop()
)
.pipe(gulp.dest('./static/js/'));
});
gulp.task('copy-libs', () =>
gulp.src([
'./node_modules/sweetalert/dist/sweetalert.min.js'
])
.pipe(gulp.dest('./static/js'))
);
gulp.task('copy-css', () =>
gulp.src([
'./node_modules/sweetalert/dist/sweetalert.css'
])
.pipe(
sass({ outputStyle: 'compressed' }).on('error', sass.logError)
)
.pipe(gulp.dest('./static/css'))
);
gulp.task('fontello', () =>
gulp.src('fontello.json')
.pipe(require('gulp-fontello')())
.pipe(gulp.dest('./static/fontello'))
);