git ssb

1+

Daan Patchwork / patchwork



Tree: 2aba282967b6a030aeb637a4592a0572ac1451b7

Files: 2aba282967b6a030aeb637a4592a0572ac1451b7 / styles / index.js

917 bytesRaw
1const path = require('path')
2const fs = require('fs')
3const compile = require('micro-css')
4
5const vendorPaths = [require.resolve('flatpickr/dist/flatpickr.css')]
6const vendorCss = vendorPaths.map((vendorPath) => fs.readFileSync(vendorPath, 'utf8'))
7
8const theme = (themeName) => {
9 const themePath = path.join(__dirname, themeName)
10 const basePath = path.join(__dirname, 'base')
11 const dirs = [basePath, themePath]
12
13 const mcss = []
14 const css = [...vendorCss]
15
16 dirs.forEach(dir => {
17 fs.readdirSync(dir).forEach(file => {
18 if (/\.mcss$/i.test(file)) {
19 mcss.push(fs.readFileSync(path.resolve(dir, file), 'utf8'))
20 }
21 if (/\.css$/i.test(file)) {
22 css.push(fs.readFileSync(path.resolve(dir, file), 'utf8'))
23 }
24 })
25 })
26
27 return compile(mcss.join('\n')) + css.join('\n')
28}
29
30module.exports = {
31 light: theme('light'),
32 dark: theme('dark'),
33 dracula: theme('dracula')
34}
35

Built with git-ssb-web