-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
143 lines (118 loc) · 2.87 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
138
139
140
141
142
/*jslint node: true */
'use strict';
var gulp = require('gulp');
// var nodemon = require('gulp-nodemon');
// var jest = require('gulp-jest');
var cssmin = require('gulp-cssmin');
var livereload = require('gulp-livereload');
// var env = require('gulp-env');
var browserifyTask = require('./gulp/browserify');
var styleTask = require('./gulp/style');
var goTask = require('./gulp/go');
var dest = './build',
src = './src/client',
mui = './node_modules/material-ui/src',
dependencies = [
'react',
'react-addons',
'fluxible',
'react-tools',
];
var config = {
server:{
main: '.'
},
Less: {
src: src + '/styles/less/main.less',
watch: [src +'/styles/**/*.less', src+'/app/**/*.less'],
dest: dest
},
injectPaths:{
src:'./gulp/paths.js',
dest:'./'
},
fonts: {
src: mui + '/less/material-design-fonticons/fonts/**',
dest: dest + '/fonts/mdfonticon'
},
muiFonts: {
src: mui + '/less/material-ui-icons/fonts/**',
dest: dest + '/fonts'
},
Browserify: {
// Enable source maps
debug: true,
// A separate bundle will be generated for each
// bundle config in the list below
bundleConfigs: [{
entries: src + '/app/client.jsx',
dest: dest,
outputName: 'main.js',
dependencies: dependencies
}]
}
};
gulp.task('serve', ['browserify','less','watch'], function () {
// lr().listen(35729,function(){
livereload.listen(35729, function(){
console.log('live reload listening on 35729');
});
});
gulp.task('go',function(){
goTask(config.server,{
development:true
});
});
gulp.task('watch',function(){
gulp.watch([config.Less.watch],['less']);
});
gulp.task('browserify',function(){
browserifyTask(config.Browserify,{
development: true
});
});
gulp.task('less',function(){
styleTask(config.Less,{
development: true
});
});
gulp.task('deploy', function () {
browserifyTask(config.Browserify,{
development: false
});
styleTask(config.Less,{
development: false,
});
});
// gulp.task('set-env', function () {
// env({
// file:'./server/config/local.env'
// });
// });
// gulp.task('inject-paths',function(){
// injectPathsTask(config.injectPaths);
// });
// gulp.task('nodemon', function(done){
// nodemon({ script: './index', env: { 'NODE_ENV': 'development'}})
// .on('restart');
// });
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['serve']);
// gulp.task('jest', function () {
// return gulp.src('./client/app/src/').pipe(jest({
// scriptPreprocessor: "./preprocessor.js",
// unmockedModulePathPatterns: [
// "node_modules/react"
// ],
// testDirectoryName: "tests",
// testPathIgnorePatterns: [
// "node_modules",
// "spec/support"
// ],
// moduleFileExtensions: [
// "js",
// "json",
// "react"
// ]
// }));
// });