Skip to content

Added CDN option to jureptool#16

Merged
filipesmg merged 6 commits into
FZJ-JSC:mainfrom
Matth-L:main
Jan 7, 2026
Merged

Added CDN option to jureptool#16
filipesmg merged 6 commits into
FZJ-JSC:mainfrom
Matth-L:main

Conversation

@Matth-L
Copy link
Copy Markdown
Contributor

@Matth-L Matth-L commented Jan 6, 2026

Hello,

Happy new year and best wishes.

While working on understanding how JURI and JurepTool work, I saw that originally jureptool was supposed to allow users to define the location of the plotly.js file, i.e.:

  --plotlyjs PLOTLYJS   Location of the 'plotly.min.js' file (default: 'cdn')

However, upon reviewing the code, this option is disabled. Additionally, CDNs are no longer used, and JurepTool now relies solely on JURI to function.

I added options on the config file to let user decide if they want to use CDN or their own .js file. These changes should allow jureptool to work even without JURI.

Note that some of the changes are due to trailing spaces being deleted.

@filipesmg
Copy link
Copy Markdown
Collaborator

Hi Matthias, that was indeed a mistake on my side - I forgot to keep this option working after many updates.

I like your suggestion, but I think we can simplify it from the user side - i.e., to make the configuration more intuitive. How about instead of this:

use_cdn: false
cdn_jquery: 'https://code.jquery.com/jquery-3.6.0.min.js'
cdn_plotly: 'https://cdn.plot.ly/plotly-latest.min.js'

# otherwise, if you want to use it locally without relying on JURI,
# you can add the jquery.min.js and the plotly.min.js
# ex : jquery_path: 'foo/bar/jquery.min.js'

# If you leave these as null:
#   - Jureptool will automatically use the built-in copies from JURI/js/ext
#   - Or, if `use_cdn` is set to True, the CDN versions of jquery and plotly will be used.
jquery_path: null
plotly_path: null

we do only

plotly_location: 
jquery_location:

As you said: CDNs are not used, and maybe the libraries are in other repositories. So, the user could give any address there. Then check would be something like:

  # Getting location of plotly
  if loc := config['appearance'].get('plotly_location'):
      plotly_path = loc
  else:
    plotly_path = f"{replace_vars(config['appearance']['hostname'], config['appearance'])}/js/ext/plotly.min.js"
  # Getting location of jquery
  if loc := config['appearance'].get('jquery_location'):
      jquery_path = loc
  else:
    jquery_path = f"{replace_vars(config['appearance']['hostname'], config['appearance'])}/js/ext/jquery.min.js"

I'd say there are 3 options for each of the locations:

  • no 'plotly_location' is given in the config. In this case, use the replace_vars with hostname;
  • 'plotly_location' is given and starts with http. That is the "CDN" case, and we should just substitute there
  • 'plotly_location' is given and is a path. This should also be directly substituted (this is what I understood when you used config['appearance'].get('plotly_path')).

What do you think?

@Matth-L
Copy link
Copy Markdown
Contributor Author

Matth-L commented Jan 7, 2026

Indeed, this simplification seems even better and all of the options listed above should work.

@filipesmg filipesmg merged commit 5498d75 into FZJ-JSC:main Jan 7, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants