-
Notifications
You must be signed in to change notification settings - Fork 137
/
gulpfile.js
89 lines (76 loc) · 2.6 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
var gulp = require('gulp');
var webpack = require('webpack-stream');
var concat = require('gulp-concat');
var less = require('gulp-less');
var babel = require('gulp-babel');
var connect = require('gulp-connect');
var merge = require('merge-stream');
var runSequence = require('run-sequence');
var webpackDevConf = require('./webpack.dev.config.js');
var webpackProductionConf = require('./webpack.production.config.js');
var webpackExamplesConf = require('./webpackExamples.config.js');
gulp.task('build', function() {
return gulp.src('src/js/ScrollAreaWithCss.js')
.pipe(webpack(webpackDevConf))
.pipe(concat('scrollArea.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('build-nocss', function() {
return gulp.src('src/js/ScrollAreaWithoutCss.js')
.pipe(webpack(webpackDevConf))
.pipe(concat('no-css.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('build-production', function() {
return gulp.src('src/js/ScrollAreaWithCss.js')
.pipe(webpack(webpackProductionConf))
.pipe(concat('scrollArea.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('build-production-nocss', function() {
return gulp.src('src/js/ScrollAreaWithoutCss.js')
.pipe(webpack(webpackProductionConf))
.pipe(concat('no-css.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('less', function(){
return gulp.src('./src/less/scrollArea.less')
.pipe(less())
.pipe(gulp.dest('./dist/css/'));
});
gulp.task('build-examples', function(){
return gulp.src('examples/js/main.js')
.pipe(webpack(webpackExamplesConf))
.pipe(concat('main.js'))
.pipe(gulp.dest('examples'))
.pipe(connect.reload());
});
gulp.task("connect", function(){
connect.server({
root: 'dist',
livereload: true,
port: 8003
});
});
gulp.task('less-examples', function(){
return gulp.src('./examples/less/**/*.less')
.pipe(less())
.pipe(gulp.dest('examples'))
.pipe(connect.reload());
});
gulp.task('default', function(callback){
runSequence('build', 'build-nocss', 'less', ['build-examples', 'less-examples'], callback);
});
gulp.task('production', function(callback){
runSequence('build-production', 'build-production-nocss', 'less', callback);
});
gulp.task('watch', function() {
connect.server({
root: 'examples',
livereload: true,
port: 8003
});
gulp.watch(['src/**/*.js', 'src/**/*.jsx', 'src/**/*.less'], ['default']);
gulp.watch(['examples/**/js/**/*.js', 'examples/**/*.jsx'], ['build-examples']);
gulp.watch('examples/**/*.less', ['less-examples']);
});