You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's tiresome to constantly reload the built pdf into a pdf viewer for each build.
Describe the solution you'd like
It would be great to combine Nodemon and the Open package so that the pdf viewer is automatically updated with the most recently built version of the pdf.
HOW TO SET IT UP:
If you don't have Node.js installed, download the installer from the official website (https://nodejs.org/) and follow the installation instructions.
Open Terminal and install nodemon and open libraries globally with the following command:
npm install -g nodemon open
Create a JavaScript file, for example, refreshPreview.js, and open it with your preferred text editor.
Paste the following JavaScript code into the file:
constopen=require('open');constfilePath=process.argv[2];if(!filePath){console.error('Please provide a file path as an argument.');process.exit(1);}(async()=>{console.log(`File ${filePath} changed. Reloading Preview...`);// Close the current Preview instanceawaitopen(filePath,{app: 'Preview',wait: true}).catch(()=>{});// Reopen the file with Previewawaitopen(filePath,{app: 'Preview'});})();
Save the file and close the text editor.
Now you can run nodemon with the path to the file you want to watch as an argument. Open Terminal and navigate to the folder containing the refreshPreview.js script, then run:
With this command, nodemon will watch the specified file for changes, and the Preview window will automatically refresh the file whenever it's updated, even if it's in the background. To stop the script, press Control + C in Terminal.
Please note that this solution uses Node.js and won't work directly in a web browser. If you're looking for a solution that works within a web browser, you may consider building a web-based PDF or image viewer using JavaScript libraries such as PDF.js or Viewer.js.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
It's tiresome to constantly reload the built pdf into a pdf viewer for each build.
Describe the solution you'd like
It would be great to combine Nodemon and the Open package so that the pdf viewer is automatically updated with the most recently built version of the pdf.
HOW TO SET IT UP:
If you don't have Node.js installed, download the installer from the official website (https://nodejs.org/) and follow the installation instructions.
Open Terminal and install
nodemon
andopen
libraries globally with the following command:Create a JavaScript file, for example,
refreshPreview.js
, and open it with your preferred text editor.Paste the following JavaScript code into the file:
Save the file and close the text editor.
Now you can run
nodemon
with the path to the file you want to watch as an argument. Open Terminal and navigate to the folder containing therefreshPreview.js
script, then run:nodemon --watch /path/to/your/file.pdf --exec "node refreshPreview.js /path/to/your/file.pdf"
With this command,
nodemon
will watch the specified file for changes, and the Preview window will automatically refresh the file whenever it's updated, even if it's in the background. To stop the script, pressControl
+C
in Terminal.Please note that this solution uses Node.js and won't work directly in a web browser. If you're looking for a solution that works within a web browser, you may consider building a web-based PDF or image viewer using JavaScript libraries such as PDF.js or Viewer.js.
The text was updated successfully, but these errors were encountered: