• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Custom .js file not copied to project (RH 2020.6.76)

Contributor ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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 
<script src="../../../assets/scripts/webhelp_scripts.js"></script>

 

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?

Views

96

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 15, 2022 Feb 15, 2022

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.

Votes

Translate

Translate
Community Expert ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

My fault, it actually was 2020.6. I have edited the subject line to reflect the correct info.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 16, 2022 Feb 16, 2022

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp