-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
executable file
·67 lines (52 loc) · 1.99 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
'use strict';
var gulp = require('gulp'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
changed = require('gulp-changed'),
cssnano = require('gulp-cssnano');
// --------------------------------------------------
// SASS - Compile Sass files into CSS
// --------------------------------------------------
gulp.task('sass', function () {
// Theme
gulp.src([
'./assets/include/scss/**/*.scss',
'!./assets/include/scss/vendors/bootstrap/',
'!./assets/include/scss/vendors/bootstrap/**/*.scss'
])
.pipe(changed('./assets/css/'))
.pipe(sass({ outputStyle: 'expanded' }))
.on('error', sass.logError)
.pipe(gulp.dest('./assets/css/'));
});
// Bootstrap SASS to CSS
gulp.task('sass-bootstrap', function() {
return gulp.src('./assets/include/scss/vendors/bootstrap/**/*.scss')
.pipe(changed('./assets/vendors/bootstrap/css/'))
.pipe(sass({outputStyle:'expanded'}))
.on('error', sass.logError)
.pipe(gulp.dest('./assets/vendors/bootstrap/css/'))
});
// --------------------------------------------------
// [Gulp Tasks and Watch]
// --------------------------------------------------
// This handles watching and running tasks
gulp.task('watch', function () {
gulp.watch('./assets/include/scss/**/*.scss', ['sass']);
gulp.watch('./assets/include/scss/vendors/bootstrap/**/*.scss', ['sass-bootstrap']);
});
// Lets us type "gulp" on the command line and run all of our tasks
gulp.task('default', ['sass', 'sass-bootstrap', 'watch']);
// --------------------------------------------------
// CSS minifier - minifies the below given lists
// --------------------------------------------------
gulp.task('minCSS', function() {
return gulp.src([
// Bootstrap
'./assets/vendors/bootstrap/css/bootstrap.css',
])
.pipe(cssnano())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./assets/vendors/bootstrap/css/'));
});
gulp.task('distMinCSS', ['minCSS']);