添加css

This commit is contained in:
黄心宇 2024-07-15 08:53:39 +08:00
parent ff8b5896f9
commit 5fc39aa117
1 changed files with 4 additions and 0 deletions

View File

@ -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)