Files: 735a21fa879fddd250e0fe6224dbb269061f32d6 / modules_core / styles.js
788 bytesRaw
1 | var h = require('../h') |
2 | var compile = require('micro-css') |
3 | var fs = require('fs') |
4 | var Path = require('path') |
5 | |
6 | // TODO distribute these styles across all |
7 | // the relevant modules, not as a core style. |
8 | var coreStyle = fs.readFileSync(Path.join(__dirname, '../style.css')) |
9 | |
10 | module.exports = { |
11 | needs: { |
12 | mcss: 'map', |
13 | css: 'map' |
14 | }, |
15 | gives: { |
16 | mcss: true, |
17 | css: true, |
18 | styles: true |
19 | }, |
20 | create: function (api) { |
21 | var styles = '' |
22 | process.nextTick(function () { |
23 | var mcss = api.mcss().join('\n') |
24 | var css = api.css().join('\n') |
25 | styles = coreStyle + compile(mcss) + css |
26 | }) |
27 | return { |
28 | styles: function () { return styles }, |
29 | // export empty styles |
30 | mcss: function () { return '' }, |
31 | css: function () { return '' } |
32 | } |
33 | } |
34 | } |
35 |
Built with git-ssb-web