-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
137 lines (110 loc) · 3.51 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
var gulp = require('gulp');
var sass = require('gulp-sass');
var react = require('gulp-react');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var addsrc = require('gulp-add-src');
var changed = require('gulp-changed');
var Sheets = [
'./resources/assets/sass/template.scss',
'./resources/assets/sass/template-basic.scss'
];
var Scripts = [
// utilities
'./resources/assets/react/utilities/Utilities.jsx',
'./resources/assets/react/utilities/*.jsx',
// verbiage
// './resources/assets/react/verbiage/Verbiage.jsx',
// './resources/assets/react/verbiage/*.jsx',
// modals
'./resources/assets/react/modals/Modals.jsx',
'./resources/assets/react/modals/*.jsx',
// data-displays
'./resources/assets/react/data-displays/DataDisplays.jsx',
'./resources/assets/react/data-displays/*.jsx',
// fields
'./resources/assets/react/fields/Fields.jsx',
'./resources/assets/react/fields/*.jsx',
// flow-editor
'./resources/assets/react/flow-editor/FlowEditor.jsx',
'./resources/assets/react/flow-editor/*.jsx',
// patients
'./resources/assets/react/patients/Patients.jsx',
'./resources/assets/react/patients/*.jsx',
// stage-visits
'./resources/assets/react/stage-visits/StageVisits.jsx',
'./resources/assets/react/stage-visits/*.jsx',
// visit
'./resources/assets/react/visit/Visit.jsx',
'./resources/assets/react/visit/*.jsx',
];
gulp.task('default', function () {
/**
* Build SASS resources
*/
var SassSheets = gulp.src(Sheets);
// Uncompressed development version
SassSheets
.pipe(changed("./public/assets/css"))
.pipe(rename(function(path) {
path.extname = ".css";
}))
.pipe(sass())
.pipe(gulp.dest('./public/assets/css'));
/**
* Build REACT assets
*/
var ReactScripts = gulp.src(Scripts);
// Build compiled development version
ReactScripts
.pipe(changed("./public/assets/js"))
.pipe(react())
.pipe(concat('compiled.js'))
.pipe(gulp.dest('./public/assets/js'));
});
gulp.task("vendor", function() {
var VendorScripts = gulp.src([
'./public/assets/bootstrap/dist/js/bootstrap.js',
'./public/assets/tether-1.1.1/dist/js/tether.js',
'./public/assets/react/react.js',
'./public/assets/react/react-dom.js',
]);
// Non-minified vendor scripts for testing
VendorScripts
.pipe(concat('vendor.js'))
.pipe(gulp.dest('./public/assets/js'));
// Minified vendor scripts
VendorScripts
.pipe(concat('vendor.min.js'))
.pipe(uglify({
mangle: false
}))
.pipe(gulp.dest('./public/assets/js'));
});
gulp.task("minify", function() {
var SassSheets = gulp.src(Sheets);
// Compressed production version
SassSheets
.pipe(changed("./public/assets/css"))
.pipe(rename(function(path) {
path.extname = ".min.css";
}))
.pipe(sass({
outputStyle: 'compressed'
}))
.pipe(gulp.dest('./public/assets/css'));
var ReactScripts = gulp.src(Scripts);
// Build compiled production version
ReactScripts
.pipe(changed("./public/assets/js"))
.pipe(react())
.pipe(concat('compiled.min.js'))
.pipe(uglify({
mangle: true,
compress: {
drop_console: true,
}
}))
.pipe(gulp.dest('./public/assets/js'));
});