forked from vexip-ui/vexip-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.ts
56 lines (42 loc) · 1.39 KB
/
gulpfile.ts
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
import { resolve } from 'node:path'
import fs from 'fs-extra'
import { dest, parallel, series, src } from 'gulp'
import gulpSass from 'gulp-sass'
import dartSass from 'sass'
import autoprefixer from 'gulp-autoprefixer'
import cleanCSS from 'gulp-clean-css'
const { existsSync, emptyDir, mkdirSync } = fs
const cssDir = resolve(__dirname, 'css')
const themesDir = resolve(__dirname, 'themes')
function buildStyle() {
ensureEmptyDir(cssDir)
const sass = gulpSass(dartSass)
return src(resolve(__dirname, 'style/*.scss'))
.pipe(sass.sync())
.pipe(autoprefixer({ cascade: false }))
.pipe(cleanCSS())
.pipe(dest(cssDir))
}
function buildDark() {
ensureEmptyDir(resolve(cssDir, 'dark'))
const sass = gulpSass(dartSass)
return src(resolve(__dirname, 'style/dark/*.scss'))
.pipe(sass.sync())
.pipe(autoprefixer({ cascade: false }))
.pipe(cleanCSS())
.pipe(dest(resolve(cssDir, 'dark')))
}
function buildThemes() {
ensureEmptyDir(themesDir)
ensureEmptyDir(resolve(themesDir, 'dark'))
const sass = gulpSass(dartSass)
return src(resolve(__dirname, 'style/dark/*.scss'))
.pipe(sass.sync())
.pipe(autoprefixer({ cascade: false }))
.pipe(cleanCSS())
.pipe(dest(resolve(themesDir, 'dark')))
}
export default parallel(series(buildStyle, buildDark), buildThemes)
function ensureEmptyDir(dir: string) {
existsSync(dir) ? emptyDir(dir) : mkdirSync(dir)
}