diff --git a/server/window.js b/server/window.js index 3ce0527a..3b201ac3 100644 --- a/server/window.js +++ b/server/window.js @@ -6,6 +6,8 @@ import axios from "axios"; const { JSDOM } = jsdom; const html = fs.readFileSync(path.join(path.resolve('./build'),'index.html'),'utf-8'); +// 压缩的项目详情页需要的css +const css = fs.readFileSync(path.join(path.resolve('./build/css'),'detail.css'),'utf-8'); const { window } = new JSDOM(html); const $ = require( "jquery" )( window ) @@ -14,6 +16,8 @@ global.window = window; global.document = window.document; global.navigator = window.navigator; global.localStorage = {} +// 全局缓存css +global.detailCss = css export const getDomObj = () => { return new JSDOM(html)