Skip to content

Commit

Permalink
Implement identical logic using Vite
Browse files Browse the repository at this point in the history
This removes the VFS fonts because they fail to build with Vite (and likely also with Rollup, which Vite uses under the hood).

See bpampuch/pdfmake#2654 for some potential ideas to resolve this.
  • Loading branch information
fwouts committed Feb 7, 2024
1 parent 1866a69 commit bd67e34
Show file tree
Hide file tree
Showing 9 changed files with 630 additions and 151 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.vscode

dist
node_modules

package/dt_bundle.js
html/index.html
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ example of how to bundle `DataTable` and one of its
extensions (buttons) and to import it dynamically
in the body of an HTML document.

The final document is `html/index.html`.
The final document is `package/dist/index.html`.

It is generated with the following commands:

```
# create dt_bundle.js
cd package
rollup --config
# inject dt_bundle.js into index.html
cd ../html
python replace_dt_src_with_base64_encoding.py
```
npm install
npm run build
```
12 changes: 0 additions & 12 deletions html/replace_dt_src_with_base64_encoding.py

This file was deleted.

2 changes: 1 addition & 1 deletion html/page_template.html → package/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<table id="table_id"><thead><tr><th>A</th></tr></thead></table>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css">
<script type="module">
let {DataTable, $} = await import(window.dt_bundle_source);
import {DataTable, jQuery as $} from "./src/dt_with_buttons.js";

// Define the table data
const data = [];
Expand Down
Loading

0 comments on commit bd67e34

Please sign in to comment.