-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
70 lines (63 loc) · 2.05 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
const { dest, series, src } = require('gulp');
const del = require('del');
const merge = require('merge-stream');
const sass = require('gulp-sass')(require('sass'));
const header = require('gulp-header');
const importOnce = require('node-sass-import-once');
const concat = require('gulp-concat');
const path = require('path');
const replace = require('gulp-replace');
const minifyCSS = require('gulp-clean-css');
function clean() {
return del([
'web/themes/custom/relaunch2018/css',
'web/themes/custom/seven_subtheme/css',
'web/modules/custom/form_alterations/css'
]);
}
function scss() {
const headerNote = [
'@charset "UTF-8";',
''
].join('\n');
const root = 'web/themes/custom/relaunch2018/';
const sassOptions = {
importer: importOnce,
includePaths: [
path.resolve(__dirname + '/web/libraries/bootstrap/scss'),
path.resolve(__dirname + '/web/themes/custom/relaunch2018/scss'),
path.resolve(__dirname + '/web/themes/custom/relaunch2018/scss/includes')
]
};
return merge(
src(root + 'scss/global.scss')
.pipe(sass(sassOptions))
.pipe(replace(/@charset [^;]+;/g, ''))
.pipe(minifyCSS())
.pipe(header(headerNote))
.pipe(dest(root + 'css')),
// Standalone styles.css is supplied to backend CKEditor.
src(root + 'scss/styles.scss')
.pipe(sass(sassOptions))
.pipe(replace(/@charset [^;]+;/g, ''))
.pipe(minifyCSS())
.pipe(header(headerNote))
.pipe(dest(root + 'css')),
// Admin theme CSS
src('web/themes/custom/seven_subtheme/scss/*.scss')
.pipe(concat('styles.scss'))
.pipe(sass(sassOptions))
.pipe(replace(/@charset [^;]+;/g, ''))
.pipe(minifyCSS())
.pipe(header(headerNote))
.pipe(dest('web/themes/custom/seven_subtheme/css')),
// Custom form CSS
src('web/modules/custom/form_alterations/scss/*.scss')
.pipe(sass(sassOptions))
.pipe(replace(/@charset [^;]+;/g, ''))
.pipe(minifyCSS())
.pipe(header(headerNote))
.pipe(dest('web/modules/custom/form_alterations/css'))
);
}
exports.default = series(clean, scss);