-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
46 lines (36 loc) · 1.19 KB
/
gulpfile.js
File metadata and controls
46 lines (36 loc) · 1.19 KB
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
var gulp = require('gulp'),
less = require('gulp-less'),
concat = require('gulp-concat'),
sourcemaps = require('gulp-sourcemaps'),
nodemon = require('gulp-nodemon');
var combiner = require('stream-combiner2');
var allModules = './public/js/**/*.module.js',
appCssPath = './public/assets/style',
componentCssPath = './public/assets/style/**/*.less',
jsPath = './public/js/**/*.js';
gulp.task('compileLess', function () {
var combined = combiner.obj([
gulp.src(appCssPath + '/app.less'),
less(),
gulp.dest(appCssPath)
]);
combined.on('error', console.log.bind(console));
return combined;
});
gulp.task('watchLess', function () {
gulp.watch(componentCssPath, ['compileLess']);
});
gulp.task('concatJsFiles', function () {
return gulp.src([allModules, jsPath])
.pipe(sourcemaps.init())
.pipe(concat('main.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./public'));
});
gulp.task('watchConcatJsFiles', function () {
gulp.watch([jsPath], ['concatJsFiles']);
});
gulp.task('startServer', function () {
nodemon({ script: 'server.js' });
});
gulp.task('default', Object.keys(gulp.tasks));