git ssb

1+

Daan Patchwork / patchwork



Tree: 83e73400cbb666a977e7f21d8c6d64570fc569b1

Files: 83e73400cbb666a977e7f21d8c6d64570fc569b1 / styles / index.js

888 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}
34

Built with git-ssb-web