Yuken Tezuka 3 лет назад
Родитель
Сommit
d5e7c14749
2 измененных файлов с 10 добавлено и 6 удалено
  1. 3 3
      packages/app/src/server/routes/hackmd.js
  2. 7 3
      packages/hackmd/src/index.js

+ 3 - 3
packages/app/src/server/routes/hackmd.js

@@ -1,4 +1,4 @@
-import { stylesCSS, styles, agent } from '@growi/hackmd';
+import { stylesCSS, stylesJS, agentJS } from '@growi/hackmd';
 
 import loggerFactory from '~/utils/logger';
 
@@ -62,7 +62,7 @@ module.exports = function(crowi, app) {
     };
 
     // inject origin to script
-    const script = ejs.render(agent, definitions);
+    const script = ejs.render(agentJS, definitions);
 
     res.set('Content-Type', 'application/javascript');
     res.send(script);
@@ -84,7 +84,7 @@ module.exports = function(crowi, app) {
       styles: stylesCSS,
     };
     // inject styles to script
-    const script = ejs.render(styles, definitions);
+    const script = ejs.render(stylesJS, definitions);
 
     res.set('Content-Type', 'application/javascript');
     res.send(script);

+ 7 - 3
packages/hackmd/src/index.js

@@ -1,7 +1,11 @@
 const fs = require('fs');
 const path = require('path');
 
+const stylesJSFile = fs.readFileSync(path.resolve(__dirname, '../dist/assets/styles_bundle.js'));
+const agentJSFile = fs.readFileSync(path.resolve(__dirname, '../dist/assets/agent_bundle.js'));
+const stylesCSSFile = fs.readFileSync(path.resolve(__dirname, '../dist/assets/styles_bundle.css'));
+
 // export to app as string
-export const styles = fs.readFileSync(path.resolve(__dirname, '../dist/assets/styles_bundle.js')).toString();
-export const agent = fs.readFileSync(path.resolve(__dirname, '../dist/assets/agent_bundle.js')).toString();
-export const stylesCSS = fs.readFileSync(path.resolve(__dirname, '../dist/assets/styles_bundle.css')).toString();
+export const stylesJS = stylesJSFile.toString();
+export const agentJS = agentJSFile.toString();
+export const stylesCSS = stylesCSSFile.toString();