-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
64 lines (53 loc) · 1.3 KB
/
gulpfile.babel.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
'use strict';
import concat from 'gulp-concat';
import del from 'del';
import gulp from 'gulp';
import sass from 'gulp-sass';
import header from 'gulp-header';
import pkg from './package.json';
import browserSync from 'browser-sync';
const server = browserSync.create();
const comment = `/**
* My css framework v${pkg.version}
* Copyright 2019 Samuel Ridings
* www.samridings.com
*/\r\n`;
const filePaths = {
scss: {
src: 'src/index.scss',
components: 'src/components/*.scss',
config: 'src/config/*.scss',
mixins: 'src/mixins/*.scss'
},
out: {
dist: './dist'
}
};
function reload(done) {
server.reload();
done();
};
function serve(done) {
server.init({
server: {
baseDir: './'
}
});
done();
};
const clean = () => del(['dist']);
function styles() {
return gulp.src(filePaths.scss.src)
.pipe(concat('myframework.scss'))
.pipe(header(comment + "\r\n"))
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(filePaths.out.dist))
};
const watch = () => gulp.watch([
filePaths.scss.src,
filePaths.scss.components,
filePaths.scss.config,
filePaths.scss.mixins
], gulp.series(styles, reload));
const dev = gulp.series(clean, styles, serve, watch);
export default dev;