-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
76 lines (66 loc) · 2.04 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
var gulp = require('gulp');
var gutil = require("gulp-util");
var webpack = require("webpack");
var webpackStream = require('webpack-stream');
var notifier = require('node-notifier');
var compass = require('gulp-compass');
var rename = require('gulp-rename');
var cleanCss = require('gulp-clean-css');
var uglify = require('gulp-uglify');
function logError(error){
notifier.notify({
title: error.plugin,
message: error.message
})
gutil.log(error)
}
gulp.task('build-sass', function() {
return gulp.src(['src/sass/*.scss', 'src/sass/**/*.scss'])
.pipe(compass({
css: 'dist/css',
sass: 'src/sass'
}))
.on('error', logError)
.pipe(gulp.dest('dist/css'))
.pipe(gulp.dest('docs/css'))
.pipe(rename({ suffix: '.min' }))
.pipe(cleanCss())
.on('error', logError)
.pipe(gulp.dest('dist/css'))
;
});
gulp.task('watch-sass', function() {
gulp.watch(['src/sass/*.scss', 'src/sass/**/*.scss'], ['build-sass']);
});
gulp.task('build-docs-sass', function() {
return gulp.src(['docs-src/sass/*.scss', 'docs-src/sass/**/*.scss'])
.pipe(compass({
css: 'docs/css',
sass: 'docs-src/sass'
}))
.on('error', logError)
.pipe(gulp.dest('docs/css'))
;
});
gulp.task('watch-docs-sass', function() {
gulp.watch(['docs-src/sass/*.scss', 'docs-src/sass/**/*.scss'], ['build-docs-sass']);
});
gulp.task('build-src', function() {
var config = require('./src/js/webpack.config.js');
return gulp.src('src/js/react-calcpicker.js')
.pipe(webpackStream(config, webpack))
.on('error', logError)
.pipe(gulp.dest('./dist'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify())
.on('error', logError)
.pipe(gulp.dest('./dist'))
});
gulp.task('build-docs', function() {
var config = require('./docs-src/js/webpack.config.js');
return gulp.src('./docs-src/js/app.js')
.pipe(webpackStream(config, webpack))
.on('error', logError)
.pipe(gulp.dest('./dist'))
});
gulp.task('default', ['build-sass', 'build-docs-sass', 'build-src', 'build-docs', 'watch-sass', 'watch-docs-sass'])