-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
90 lines (78 loc) · 1.91 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { src, dest, series, parallel, watch, lastRun } from "gulp";
import path from "path";
import scss from "gulp-sass";
import sourcemaps from 'gulp-sourcemaps';
import postcss from 'gulp-postcss';
import rename from 'gulp-rename';
import autoprefixer from "autoprefixer";
import del from "del";
import cssnano from "cssnano";
import sassdoc from "sassdoc"
import moduleImporter from 'sass-module-importer';
import browserSync from 'browser-sync';
const server = browserSync.create();
const paths = {
scss: {
src: "./scss",
dest: "./dist"
},
docs: {
dest: "./docs"
}
}
function clean(cb){
return del(`${paths.scss.dest}/**`);
}
export function cleanDocs(cb){
return del(`${paths.docs.dest}/**`);
}
function build(cb){
var plugins = [
autoprefixer(),
cssnano()
];
return src(`${paths.scss.src}/qnorr.scss`, { since: lastRun(build) })
.pipe(sourcemaps.init())
.pipe(scss({
importer: moduleImporter()
}).on('error', scss.logError))
.pipe(postcss([autoprefixer()]))
.pipe(dest(paths.scss.dest)) // non minified version
.pipe(postcss(plugins))
.pipe(rename({ suffix: '.min' }))
.pipe(sourcemaps.write('.'))
.pipe(dest(paths.scss.dest))
}
export function sassDocs(done) {
const options = {
dest: 'docs',
verbose: true,
//theme: "flippant"
};
const stream = sassdoc(options);
src(`${paths.scss.src}/**/*.scss`)
.pipe(stream)
.on('end', function () {
console.log('End of parsing phase');
});
return stream.promise.then(function () {
console.log('End of documentation process');
});
}
function reload(done) {
server.reload();
done();
}
function serve(done) {
server.init({
server: {
baseDir: paths.docs.dest
}
});
done();
}
export function watching() {
watch(`${paths.scss.src}/**/*.scss`, series(build, sassDocs, reload));
}
exports["dev"] = series(cleanDocs, clean, build, sassDocs, serve, watching);
export default series(clean, build, sassDocs);