I want to add external JavaScript library in my module. It looks something like below script code
<script
src="<?php echo $block->escapeUrl($block->getJsLibUrl());?>"
data-min="<?php echo (int)$block->getMinLimit(); ?>"
data-max="<?php echo (int)$block->getMaxLimit(); ?>" async>
</script>
Here, the script URL is dynamic and data min/max values too.
I am not sure how I can add this external js library with data attributes in Magento 2 standard way. Is it fine if I will add this script in .phtml file? or is there any alternate way to add using requireJS?
Thanks for your attention and help in advance. Feel free to ask if more details are needed.