-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
74 lines (65 loc) · 1.68 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
/*!
* Author: Ahmed Tokyo
* ahmed.tokyo1@gmail.com
* tokyo@dreidev.com
*/
var gulp = require('gulp');
var sass = require('gulp-sass');
var connect = require('gulp-connect');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
var runSequence = require('run-sequence');
var cssnano = require('gulp-cssnano');
var rename = require('gulp-rename');
gulp.task('default', ['build']);
gulp.task('html', function () {
gulp.src('src/*.html')
.pipe(connect.reload());
});
gulp.task('sass', function() {
return gulp.src('src/scss/**/*.scss') // Gets all files ending with .scss in app/scss and children dirs
.pipe(sass())
.pipe(gulp.dest('src/css'))
.pipe(connect.reload());
});
gulp.task('server', function() {
connect.server({
livereload: true,
root: 'src',
port: 9001,
https: false
});
});
gulp.task('watch', function (){
gulp.watch('src/scss/**/*.scss', ['sass']);
gulp.watch('src/*.html', ['html']);
});
gulp.task('start', ['sass', 'watch', 'server']);
gulp.task('clean:dist', function() {
return del.sync('dist');
});
gulp.task('build-sass', function() {
// Regular File
gulp.src(['src/scss/**/[^_]*.scss', '!src/scss/demo/*'])
.pipe(sass())
.pipe(autoprefixer({
browsers: ['last 5 versions'],
cascade: false
}))
.pipe(gulp.dest('dist/'));
// Minified File
gulp.src(['src/scss/**/[^_]*.scss', '!src/scss/demo/*'])
.pipe(sass())
.pipe(cssnano())
.pipe(rename({suffix: '.min'}))
.pipe(autoprefixer({
browsers: ['last 5 versions'],
cascade: false
}))
.pipe(gulp.dest('dist/'));
});
gulp.task('build', function (callback) {
runSequence('clean:dist',
['build-sass']
)
});