-
Notifications
You must be signed in to change notification settings - Fork 242
/
Copy pathgulpfile.js
61 lines (56 loc) · 1.49 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
const gulp = require("gulp");
const sass = require('gulp-sass')(require('node-sass'));
const cleancss = require('gulp-clean-css');
const csscomb = require('gulp-csscomb');
const rename = require('gulp-rename');
const autoprefixer = require('gulp-autoprefixer');
const pug = require('gulp-pug');
const plumber = require('gulp-plumber');
const { exec } = require('child_process');
function css() {
return gulp
.src('./src/devices.scss')
.pipe(sass({outputStyle: 'compact', precision: 2})
.on('error', sass.logError)
)
.pipe(autoprefixer())
.pipe(csscomb())
.pipe(gulp.dest('./dist'))
.pipe(cleancss())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./docs/assets/css'));
}
function web_css() {
return gulp
.src(['./src/devices.scss', './docs/scss/demo.scss'])
.pipe(sass({outputStyle: 'compact', precision: 2})
.on('error', sass.logError)
)
.pipe(autoprefixer())
.pipe(csscomb())
.pipe(cleancss())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./docs/assets/css'));
}
function web_docs() {
return gulp
.src('./docs/pug/!(_)*.pug')
.pipe(plumber())
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest('./docs'));
}
function watch() {
gulp.watch('./**/*.scss', gulp.series(css, web_css));
gulp.watch('./**/*.pug', gulp.series(web_docs, web_css));
}
exports.watch = watch;
exports.css = css;
exports.web = gulp.series(web_docs, web_css);
exports.default = css;