git ssb

16+

Dominic / patchbay



Tree: 9ad609d054fd59c134b3aac1b801d0aa7d8d0e5a

Files: 9ad609d054fd59c134b3aac1b801d0aa7d8d0e5a / app / sync / initialise / styles.js

880 bytesRaw
1const nest = require('depnest')
2// const insertCss = require('insert-css')
3const compileCss = require('micro-css')
4const { h, computed } = require('mutant')
5
6exports.gives = nest('app.sync.initialise')
7
8exports.needs = nest({
9 'styles.css': 'reduce',
10 'settings.obs.get': 'first'
11})
12
13exports.create = function (api) {
14 return nest('app.sync.initialise', styles)
15
16 function styles () {
17 const css = values(api.styles.css()).join('\n')
18
19 document.head.appendChild(
20 h('style', {
21 innerHTML: computed(api.settings.obs.get('patchbay.customStyles', ''), styles => {
22 const customStyles = compileCss(styles)
23
24 // apply styles twice so our mixins 'win'
25 return [customStyles, css, customStyles].join('\n')
26 })
27 })
28 )
29 }
30}
31
32function values (object) {
33 const keys = Object.keys(object)
34 return keys.map(k => object[k])
35}
36
37

Built with git-ssb-web