Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Aymkdn committed Oct 19, 2021
1 parent 855c3ee commit 27e1332
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/browser-2.3.5.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h1>HTML to PDFMake convertor</h1>
<div id="pdf_ie" style="display:none;padding:3em">The PDF file is sent to you for download. Use a modern browser (like Chrome or Firefox) to display the PDF in this page.</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/html-to-pdfmake@2.3.5/browser.js"></script>
<script src="browser-2.3.5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/pdfmake.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/vfs_fonts.js"></script>
<script>
Expand Down
10 changes: 9 additions & 1 deletion update-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ const package = require("./package.json");
const fs = require("fs");
const fileName = "./docs/index.html";

// delete all browser-*.js files
let content = fs.readdirSync('./docs/');
content.forEach(function(file) {
if (/^browser-[\d\.]+\.js$/.test(file)) fs.unlinkSync('./docs/'+file);
});
// copy the new one
fs.copyFileSync('./browser.js', './docs/browser-'+package.version+'.js');
// update the html file
fs.readFile(fileName, 'utf8', function(err, content) {
content = content.replace(/html-to-pdfmake@[\d\.]+\/browser\.js/, 'html-to-pdfmake@'+package.version+'/browser.js');
content = content.replace(/browser-[\d\.]+\.js/, 'browser-'+package.version+'.js');
fs.writeFile(fileName, content, function(err) {
if (err) throw err;
console.log("Documentation updated with last version");
Expand Down

0 comments on commit 27e1332

Please sign in to comment.