I need to use Paper.js (http://paperjs.org/), and specifically one of their examples (http://paperjs.org/examples/smoothing/) on a WordPress website.
Usually, scripts are enqued to WP with a PHP function that adds scripts of type text/javascript (https://developer.wordpress.org/reference/functions/wp_enqueue_script/) and should be fine for the Paper.js library itself.
But... The script utilizing Paper.js should be of type text/paperscript (http://paperjs.org/tutorials/getting-started/working-with-paper-js/), and the only solution I could come up with is echo both script tags to my (child theme to a Genesis Framework) header.php file:
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.11.5/paper-full.min.js" integrity="sha256-qZnxjtwxg51juOcYyANvBWwFoahMFNB2GSkGI5LGmW0=" crossorigin="anonymous"></script>
<script type='text/paperscript' canvas='smoothCanvas' href='../js/smoothing.js'></script>
Is there any other solution? I tried to search some tutorials for Paper.js on Wordpress, but couldn't find anything.
canvas
with idsmoothCanvas
, like this<canvas id="smoothCanvas" resize></canvas>
?text/paperscript
or something else?