I have made a .js file with code to sort a table column (copied from w3schools).
The code resides in my project's contents\assets\scripts\webhelp_scripts.js
The topic that contains the table to be sorted has the line
If I preview the topic in Chrome, the script works just fine.
However, if I compile the project, the js file is not copied to the \assets\scripts folder, so the sorting does not work. If I copy the .js file to the output manually, the sorting works again.
Do js files need to be in a specific location to be copied to the output?
In Classic versions, those would be considered a baggage file - I thought in 2020 they ended up in the Assets area of the project. Are you still running the very first release of RH2020? There's been 7 patches since.
My fault, it actually was 2020.6. I have edited the subject line to reflect the correct info.
Copy link to clipboard
If the file is referenced in a topic, it should get included in the generated output. If it's not, it suggests the path isn't quite correct (maybe it has too many ../ or too few?). The reason it might work with preview is there is another copy of the file in the expected location when viewing the source, but it's not actually in the project? Perhaps look at the log file to see if there are any warnings related to the script after you generate.
Well, for some reason, the issue sorted itself 🙂
When I now generate the js file *is* copied to the output. Maybe it needed a few extra compiles (with PDF I sometimes get "failed to generate" when the 2nd run goes OK), or maybe I was viewing an old version before regenerating.
In any case, it works now. Thank you for your input!