Include three.js into wordpress theme

  php, three.js, webgl, wordpress, wordpress-theming

So basically what I am trying to achieve is simple:

I want to use three.js with my current custom wordpress theme.

Unfortunately I can’t seem to find any information on how to do so.
I enqueue all my scripts via functions.php, I guess that is the default approach.

Since three.js has to be loaded with "type=module" I can not get it to work properly, and it seems as if it has to be done in another way. Should the import statements take place in my themes header? I always think that it is bad practice… And how can I then write my three.js code into an external js file?

Can someone please help me out?

Source: Ask PHP

LEAVE A COMMENT