Commit db909573b9d8f25be1fb33a819dee9ecdccbdaf6
replace mcss loader with a dedicated function
mix irving committed on 12/31/2016, 5:26:26 AMParent: 32f3b3b65f755773019450067162f65fffd00e6f
Files changed
modules_basic/about.js | changed |
modules_basic/message-author.js | changed |
modules_basic/message-backlinks.js | changed |
modules_basic/message.js | changed |
modules_basic/timestamp.js | changed |
get-style-for-module.js | added |
modules_basic/about.js | ||
---|---|---|
@@ -1,8 +1,7 @@ | ||
1 | -var fs = require('fs') | |
2 | -var Path = require('path') | |
3 | -var h = require('../h') | |
4 | -var when = require('@mmckegg/mutant/when') | |
1 … | +const getStyleForModule = require('../get-style-for-module') | |
2 … | +const h = require('../h') | |
3 … | +const when = require('@mmckegg/mutant/when') | |
5 | 4 … | |
6 | 5 … | exports.needs = { |
7 | 6 … | blob_url: 'first', |
8 | 7 … | markdown: 'first' |
@@ -17,9 +16,9 @@ | ||
17 | 16 … | exports.create = function (api) { |
18 | 17 … | return { |
19 | 18 … | message_content, |
20 | 19 … | message_content_mini, |
21 | - mcss: () => fs.readFileSync(Path.join(__dirname, 'about.mcss'), 'utf8') | |
20 … | + mcss: getStyleForModule(__filename) | |
22 | 21 … | } |
23 | 22 … | |
24 | 23 … | function message_content (msg) { |
25 | 24 … | if (msg.value.content.type !== 'about') return |
modules_basic/message-author.js | ||
---|---|---|
@@ -1,8 +1,7 @@ | ||
1 | -var fs = require('fs') | |
2 | -var Path = require('path') | |
3 | -var h = require('../h') | |
4 | -var when = require('@mmckegg/mutant/when') | |
1 … | +const getStyleForModule = require('../get-style-for-module') | |
2 … | +const h = require('../h') | |
3 … | +const when = require('@mmckegg/mutant/when') | |
5 | 4 … | |
6 | 5 … | exports.needs = { |
7 | 6 … | avatar_link: 'first', |
8 | 7 … | avatar_image: 'first', |
@@ -17,9 +16,9 @@ | ||
17 | 16 … | |
18 | 17 … | exports.create = function (api) { |
19 | 18 … | return { |
20 | 19 … | message_author, |
21 | - mcss: () => fs.readFileSync(Path.join(__dirname, 'message-author.mcss')) | |
20 … | + mcss: getStyleForModule(__filename) | |
22 | 21 … | } |
23 | 22 … | |
24 | 23 … | function message_author (msg, opts = {}) { |
25 | 24 … | var { size = 'small' } = opts |
modules_basic/message-backlinks.js | ||
---|---|---|
@@ -1,7 +1,6 @@ | ||
1 | -var fs = require('fs') | |
2 | -var Path = require('path') | |
3 | -var h = require('../h') | |
1 … | +const getStyleForModule = require('../get-style-for-module') | |
2 … | +const h = require('../h') | |
4 | 3 … | |
5 | 4 … | exports.gives = { |
6 | 5 … | message_backlinks: true, |
7 | 6 … | mcss: true |
@@ -9,9 +8,9 @@ | ||
9 | 8 … | |
10 | 9 … | exports.create = function (api) { |
11 | 10 … | return { |
12 | 11 … | message_backlinks, |
13 | - mcss: () => fs.readFileSync(Path.join(__dirname, 'message-backlinks.mcss')) | |
12 … | + mcss: getStyleForModule(__filename) | |
14 | 13 … | } |
15 | 14 … | |
16 | 15 … | function message_backlinks (msg) { |
17 | 16 … | var links = [] |
modules_basic/message.js | ||
---|---|---|
@@ -1,9 +1,8 @@ | ||
1 | -var fs = require('fs') | |
2 | -var Path = require('path') | |
3 | -var pull = require('pull-stream') | |
4 | -var u = require('../util') | |
5 | -var h = require('../h') | |
1 … | +const getStyleForModule = require('../get-style-for-module') | |
2 … | +const pull = require('pull-stream') | |
3 … | +const u = require('../util') | |
4 … | +const h = require('../h') | |
6 | 5 … | |
7 | 6 … | exports.needs = { |
8 | 7 … | avatar_name: 'first', |
9 | 8 … | avatar_link: 'first', |
@@ -24,9 +23,9 @@ | ||
24 | 23 … | |
25 | 24 … | exports.create = function (api) { |
26 | 25 … | return { |
27 | 26 … | message_render, |
28 | - mcss: () => fs.readFileSync(Path.join(__dirname, 'message.mcss')) | |
27 … | + mcss: getStyleForModule(__filename) | |
29 | 28 … | } |
30 | 29 … | |
31 | 30 … | function message_render (msg, sbot) { |
32 | 31 … | var content = api.message_content_mini(msg) |
modules_basic/timestamp.js | ||
---|---|---|
@@ -1,8 +1,7 @@ | ||
1 | -var fs = require('fs') | |
2 | -var Path = require('path') | |
3 | -var h = require('../h') | |
4 | -var human = require('human-time') | |
1 … | +const getStyleForModule = require('../get-style-for-module') | |
2 … | +const h = require('../h') | |
3 … | +const human = require('human-time') | |
5 | 4 … | |
6 | 5 … | exports.needs = {} |
7 | 6 … | |
8 | 7 … | exports.gives = { |
@@ -17,9 +16,9 @@ | ||
17 | 16 … | }, 60e3) |
18 | 17 … | |
19 | 18 … | return { |
20 | 19 … | timestamp, |
21 | - mcss: () => fs.readFileSync(Path.join(__dirname, 'timestamp.mcss')) | |
20 … | + mcss: getStyleForModule(__filename) | |
22 | 21 … | } |
23 | 22 … | |
24 | 23 … | function updateTimestampEl (el) { |
25 | 24 … | var timestamp = Number(el.getAttribute('data-timestamp')) |
Built with git-ssb-web