-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
42 lines (40 loc) · 1.39 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
/* eslint-env node */
const clean = require('gulp-clean'),
editor = require('mem-fs-editor'),
gulp = require('gulp'),
memFs = require('mem-fs'),
path = require('path');
gulp.task('build', ['clean'], done => {
const settings = require('./src/settings'),
store = memFs.create(),
fs = editor.create(store),
source = path.join(__dirname, 'src/theme.json'),
context = {
attributes: settings.COLORS.ATTRIBUTES,
background: settings.COLORS.BACKGROUND,
comment: settings.COLORS.COMMENT,
constants: settings.COLORS.CONSTANTS,
cssClass: settings.COLORS.CSS_CLASS,
functionDeclarations: settings.COLORS.FUNCTION_DECLARATIONS,
invalidBackground: settings.COLORS.INVALID_BACKGROUND,
invalidBorder: settings.COLORS.INVALID_BORDER,
invisibles: settings.COLORS.INVISIBLES,
keyword: settings.COLORS.KEYWORD,
name: settings.NAME,
punctuation: settings.COLORS.PUNCTUATION,
storage: settings.COLORS.STORAGE,
strings: settings.COLORS.STRINGS,
tagsAndArguments: settings.COLORS.TAGS_ARGUMENTS,
themeType: settings.THEME_TYPE,
types: settings.COLORS.TYPES
};
try {
fs.copyTpl(source, 'themes/theme.json', context);
fs.commit(() => {
done();
});
} catch (error) {
console.log(error); // eslint-disable-line
}
});
gulp.task('clean', () => gulp.src('themes', { read: false }).pipe(clean()));