aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/darkmode.js
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-08 00:01:37 +0000
committerLibravatar GitHub <noreply@github.com>2021-08-08 05:31:37 +0530
commit97d51a7763b14c92ee71ff9a012311dd9498d803 (patch)
treebd36005031ecb1148f27aa541e7a92a5e3aa4c0c /src/webview/darkmode.js
parent5.6.1-nightly.17 [skip ci] (diff)
downloadferdium-app-97d51a7763b14c92ee71ff9a012311dd9498d803.tar.gz
ferdium-app-97d51a7763b14c92ee71ff9a012311dd9498d803.tar.zst
ferdium-app-97d51a7763b14c92ee71ff9a012311dd9498d803.zip
refactor: path-references refactoring and using 'import' instead of 'require' (#1752)
* refactor references to 'userData' and 'appData' directories to move hardcoding into single location * convert to es6 for lower memory usage as per https://codesource.io/the-difference-between-import-and-require-in-javascript/
Diffstat (limited to 'src/webview/darkmode.js')
-rw-r--r--src/webview/darkmode.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/webview/darkmode.js b/src/webview/darkmode.js
index ab629435c..7435d6404 100644
--- a/src/webview/darkmode.js
+++ b/src/webview/darkmode.js
@@ -1,7 +1,7 @@
1/* eslint no-bitwise: ["error", { "int32Hint": true }] */ 1/* eslint no-bitwise: ["error", { "int32Hint": true }] */
2 2
3import path from 'path'; 3import { join } from 'path';
4import fs from 'fs-extra'; 4import { pathExistsSync, readFileSync } from 'fs-extra';
5 5
6const debug = require('debug')('Ferdi:DarkMode'); 6const debug = require('debug')('Ferdi:DarkMode');
7 7
@@ -10,9 +10,9 @@ const chars = [...'abcdefghijklmnopqrstuvwxyz'];
10const ID = [...Array(20)].map(() => chars[Math.random() * chars.length | 0]).join``; 10const ID = [...Array(20)].map(() => chars[Math.random() * chars.length | 0]).join``;
11 11
12export function injectDarkModeStyle(recipePath) { 12export function injectDarkModeStyle(recipePath) {
13 const darkModeStyle = path.join(recipePath, 'darkmode.css'); 13 const darkModeStyle = join(recipePath, 'darkmode.css');
14 if (fs.pathExistsSync(darkModeStyle)) { 14 if (pathExistsSync(darkModeStyle)) {
15 const data = fs.readFileSync(darkModeStyle); 15 const data = readFileSync(darkModeStyle);
16 const styles = document.createElement('style'); 16 const styles = document.createElement('style');
17 styles.id = ID; 17 styles.id = ID;
18 styles.innerHTML = data.toString(); 18 styles.innerHTML = data.toString();