aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/lib/RecipeWebview.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview/lib/RecipeWebview.js')
-rw-r--r--src/webview/lib/RecipeWebview.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/webview/lib/RecipeWebview.js b/src/webview/lib/RecipeWebview.js
index 305e79882..96caa125e 100644
--- a/src/webview/lib/RecipeWebview.js
+++ b/src/webview/lib/RecipeWebview.js
@@ -1,5 +1,5 @@
1import { ipcRenderer } from 'electron'; 1import { ipcRenderer } from 'electron';
2import { exists, pathExistsSync, readFile } from 'fs-extra'; 2import { exists, pathExistsSync, readFileSync } from 'fs-extra';
3 3
4const debug = require('debug')('Ferdi:Plugin:RecipeWebview'); 4const debug = require('debug')('Ferdi:Plugin:RecipeWebview');
5 5
@@ -55,9 +55,8 @@ class RecipeWebview {
55 injectCSS(...files) { 55 injectCSS(...files) {
56 files.forEach(async (file) => { 56 files.forEach(async (file) => {
57 if (pathExistsSync(file)) { 57 if (pathExistsSync(file)) {
58 const data = await readFile(file, 'utf8');
59 const styles = document.createElement('style'); 58 const styles = document.createElement('style');
60 styles.innerHTML = data; 59 styles.innerHTML = readFileSync(file, 'utf8');
61 60
62 document.querySelector('head').appendChild(styles); 61 document.querySelector('head').appendChild(styles);
63 62
@@ -69,8 +68,7 @@ class RecipeWebview {
69 injectJSUnsafe(...files) { 68 injectJSUnsafe(...files) {
70 Promise.all(files.map(async (file) => { 69 Promise.all(files.map(async (file) => {
71 if (await exists(file)) { 70 if (await exists(file)) {
72 const data = await readFile(file, 'utf8'); 71 return readFileSync(file, 'utf8');
73 return data;
74 } 72 }
75 debug('Script not found', file); 73 debug('Script not found', file);
76 return null; 74 return null;