forked from mlaursen/react-md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakeBundles.js
39 lines (33 loc) · 1010 Bytes
/
makeBundles.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
const fs = require('fs');
const path = require('path');
// Creates 255 bundles.. Need to get better at some colors and choose like 20
const colors = [
'red', 'pink', 'purple', 'deep-purple', 'indigo', 'blue', 'light-blue',
'cyan', 'teal', 'green', 'light-green', 'lime', 'yellow', 'amber', 'deep-orange',
];
const noAccents = ['brown', 'grey', 'blue-grey'];
const bundles = path.resolve(process.cwd(), 'src', 'scss', 'bundles');
try {
fs.statSync(bundles).isDirectory();
} catch (e) {
fs.mkdirSync(bundles);
} finally {
noAccents.concat(colors).forEach(color => {
colors.forEach(accent => {
if (color !== accent) {
fs.writeFile(path.join(bundles, `${color.replace('-', '_')}-${accent.replace('-', '_')}.scss`), `
@import '../react-md';
$md-primary-color: $md-${color}-500;
$md-secondary-color: $md-${accent}-a-400;
@include react-md-everything;
`,
err => {
if (err) {
throw err;
}
}
);
}
});
});
}