-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
85 lines (75 loc) · 2.55 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var rename = require("gulp-rename");
var autoprefixer = require('gulp-autoprefixer');
var ghpages = require('gulp-gh-pages');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
var autoprefixerConfig = {
browsers: ['last 2 versions'],
cascade: false
};
const sassIncludePaths = ['./nodes_modules'];
const jsVendors = [
'./node_modules/tether/dist/js/tether.js',
'./node_modules/bootstrap/js/dist/util.js',
'./node_modules/bootstrap/js/dist/modal.js',
'./node_modules/bootstrap/js/dist/tooltip.js',
'./node_modules/bootstrap/js/dist/collapse.js'
];
const errorHandler = function(error) {
console.error(error);
this.emit('end');
};
gulp.task('scss:watch', ['scss'], function() {
gulp.watch('./scss/**/*.scss', ['scss']);
});
gulp.task('scss', ['scss:min'], function () {
return gulp.src('./scss/flavors/*.scss')
.pipe(plumber({ errorHandler: errorHandler }))
.pipe(sourcemaps.init())
.pipe(sass({ includePaths: sassIncludePaths }))
.pipe(autoprefixer(autoprefixerConfig))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./dist/css'))
.pipe(gulp.dest('./docs'));
});
gulp.task('scss:min', function () {
return gulp.src('./scss/flavors/*.scss')
.pipe(plumber({ errorHandler: errorHandler }))
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed',
includePaths: sassIncludePaths,
onlyIncluded: false
}))
.pipe(autoprefixer(autoprefixerConfig))
.pipe(sourcemaps.write())
.pipe(rename(function(path) { path.extname = '.min.css' }))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('js', ['js:min'], function() {
return gulp.src(jsVendors)
.pipe(plumber({ errorHandler: errorHandler }))
.pipe(sourcemaps.init())
.pipe(concat('suitcase.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./dist/js'))
.pipe(gulp.dest('./docs'));
});
gulp.task('js:min', function() {
return gulp.src(jsVendors)
.pipe(plumber({ errorHandler: errorHandler }))
.pipe(sourcemaps.init())
.pipe(concat('suitcase.min.js'))
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./dist/js'));
});
gulp.task('docs:deploy', function() {
return gulp.src('./dist/docs/**/*')
.pipe(plumber({ errorHandler: errorHandler }))
.pipe(ghpages());
});