Skip to content

Commit

Permalink
fix: use dynamic import of transform assets to avoid fs error
Browse files Browse the repository at this point in the history
  • Loading branch information
yndx-birman committed Nov 20, 2023
1 parent 576fd37 commit 3dcb9cb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/generate/utils.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import {readFileSync} from 'fs';
import {join} from 'path';

const yfmStylesPath = require.resolve('@diplodoc/transform/dist/css/yfm.css');
const yfmStyles = readFileSync(yfmStylesPath, 'utf-8');
import {SINGLE_PAGE_DATA_FILENAME} from './constants';

const yfmPrintStylesPath = require.resolve('@diplodoc/transform/dist/css/print.css');
const yfmPrintStyles = readFileSync(yfmPrintStylesPath, 'utf-8');
export function generatePdfStaticMarkup(html: string) {
const yfmStylesPath = require.resolve('@diplodoc/transform/dist/css/yfm.css');
const yfmStyles = readFileSync(yfmStylesPath, 'utf-8');

const yfmPrintJSPath = require.resolve('@diplodoc/transform/dist/js/print.js');
const yfmPrintJS = readFileSync(yfmPrintJSPath, 'utf-8');
const yfmPrintStylesPath = require.resolve('@diplodoc/transform/dist/css/print.css');
const yfmPrintStyles = readFileSync(yfmPrintStylesPath, 'utf-8');

const yfmJSPath = require.resolve('@diplodoc/transform/dist/js/yfm.js');
const yfmJS = readFileSync(yfmJSPath, 'utf-8');
const yfmPrintJSPath = require.resolve('@diplodoc/transform/dist/js/print.js');
const yfmPrintJS = readFileSync(yfmPrintJSPath, 'utf-8');

import {SINGLE_PAGE_DATA_FILENAME} from './constants';
const yfmJSPath = require.resolve('@diplodoc/transform/dist/js/yfm.js');
const yfmJS = readFileSync(yfmJSPath, 'utf-8');

export function generatePdfStaticMarkup(html: string) {
return `
<!doctype html>
<html>
Expand Down

0 comments on commit 3dcb9cb

Please sign in to comment.