-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgulpfile.js
executable file
·62 lines (51 loc) · 1.77 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
'use strict';
var gulp = require('gulp'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
changed = require('gulp-changed'),
cssnano = require('gulp-cssnano'),
autoprefixer = require('gulp-autoprefixer');
// --------------------------------------------------
// SASS - Compile Sass files into CSS
// --------------------------------------------------
gulp.task('sass', function () {
// Theme
gulp.src('./assets/include/scss/**/*.scss')
.pipe(changed('./assets/css/'))
.pipe(sass({ outputStyle: 'expanded' }))
.on('error', sass.logError)
.pipe(autoprefixer([
"last 1 major version",
">= 1%",
"Chrome >= 45",
"Firefox >= 38",
"Edge >= 12",
"Explorer >= 10",
"iOS >= 9",
"Safari >= 9",
"Android >= 4.4",
"Opera >= 30"], { cascade: true }))
.pipe(gulp.dest('./assets/css/'));
});
// --------------------------------------------------
// CSS minifier - minifies the below given lists
// --------------------------------------------------
gulp.task('minCSS', function() {
return gulp.src([
'./assets/css/theme.css',
])
.pipe(cssnano())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/css/'));
});
// --------------------------------------------------
// [Gulp Tasks and Watch]
// --------------------------------------------------
// This handles watching and running tasks
gulp.task('watch', function () {
gulp.watch('./assets/include/scss/**/*.scss', ['sass']);
});
// Lets us type "gulp" on the command line and run all of our tasks
gulp.task('default', ['watch', 'sass']);
// Use "gulp dist" to create dist folder with minified css and js files
gulp.task('dist', ['minCSS']);