-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplopfile.js
More file actions
47 lines (46 loc) · 1.67 KB
/
plopfile.js
File metadata and controls
47 lines (46 loc) · 1.67 KB
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
const {
COLOR_REGEXP_STRINGS,
HSL_HUE,
CALC,
toRegExp
} = require('./.plop/regexps-strings');
module.exports = (plop) => {
plop.setGenerator('Compile RegExps', {
description: 'Compile the regular library regular expressions from a template file',
prompts: [],
actions: [
{
type: 'modify',
path: 'src/constants/regexps.ts',
pattern: /\/\/ START REGEXPS[\s\S]*\/\/ END REGEXPS/,
data: {
HEX: toRegExp(
COLOR_REGEXP_STRINGS.HEX,
{
caseInsensitive: true
}
),
RGB: toRegExp(COLOR_REGEXP_STRINGS.RGB),
HWB: toRegExp(COLOR_REGEXP_STRINGS.HWB),
HSL: toRegExp(COLOR_REGEXP_STRINGS.HSL),
CIELab: toRegExp(COLOR_REGEXP_STRINGS.CIELab),
LCH: toRegExp(COLOR_REGEXP_STRINGS.LCH),
CMYK: toRegExp(COLOR_REGEXP_STRINGS.CMYK),
CALC_REGEXP: toRegExp(CALC.REGEXP),
CALC_SCOPED: toRegExp(
CALC.SCOPED,
{
global: true
}
),
CALC_DIVISION: toRegExp(CALC.DIVISION),
CALC_MULTIPLICATION: toRegExp(CALC.MULTIPLICATION),
CALC_SUM: toRegExp(CALC.SUM),
CALC_REST: toRegExp(CALC.REST),
HSL_HUE
},
templateFile: '.plop/regexps.hbs'
}
]
});
};