# \[ SOLVED \] How to import Collide2D

**URL:** <https://discourse.processing.org/t/solved-how-to-import-collide2d/13713>\
**Category:** Libraries\
**Created:** [August 31, 2019, 3:43am UTC](https://discourse.processing.org/t/solved-how-to-import-collide2d/13713 "2019-08-31T03:43:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrShawn](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MrShawn](https://discourse.processing.org/u/MrShawn)\
**Post date:** [August 31, 2019, 3:43am UTC](https://discourse.processing.org/t/solved-how-to-import-collide2d/13713/1 "2019-08-31T03:43:07Z")

</div>

Hello, I am trying to import Collide2D by @bmoren into my p5js project. I added the rawgithubcontent link to the minified library in my index.html, but it didn’t import properly. How do I properly import it?  
Here is my current index.html:

```auto
<!DOCTYPE html>
<html>
  <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/addons/p5.dom.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/addons/p5.sound.min.js"></script>
    <script src="https://raw.githubusercontent.com/bmoren/p5.collide2D/master/p5.collide2d.min.js"></script>
    <link rel="stylesheet" type="text/css" href="style.css">
    <meta charset="utf-8" />

  </head>
  <body>
    <script src="sketch.js"></script>
    <script src="child.js"></script>
    <script src="mace.js"></script>
  </body>
</html>

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [August 31, 2019, 10:23am UTC](https://discourse.processing.org/t/solved-how-to-import-collide2d/13713/2 "2019-08-31T10:23:13Z")

</div>

> [@MrShawn](#):
>
> Here is my current index.html:

And here’s mine: 😛

```auto
<script defer src=https://cdn.JsDelivr.net/npm/p5></script>
<script defer src=https://cdn.JsDelivr.net/gh/bmoren/p5.collide2D/p5.collide2d.min.js></script>
<script defer src=sketch.js></script>

```

And an online running sketch too: 🏃‍♂️  
https://codepen.io/GoSubRoutine/embed/preview/YpmRRR?default-tabs=js%2Cresult&height=300&host=https%3A%2F%2Fcodepen.io&slug-hash=YpmRRR

---

<div class="post-metadata">

**Author:** ![bmoren](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bmoren/32/68_2.png) [@bmoren](https://discourse.processing.org/u/bmoren)\
**Post date:** [August 31, 2019, 1:58pm UTC](https://discourse.processing.org/t/solved-how-to-import-collide2d/13713/3 "2019-08-31T13:58:39Z")

</div>

this is likely because the raw version that github sends is encoded as plain text and is subject to MIME type sniffing. basically, we need to see this as a js file instead of a text file when it hits the browser.

more info here:

> **[X-Content-Type-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options)**
>
> The X-Content-Type-Options response HTTP header is a marker used by the server to indicate that the MIME types advertised in the Content-Type headers should not be changed and be followed. This allows to opt-out of MIME type sniffing, or, in other...

  

> <https://stackoverflow.com/questions/7180099/including-js-from-raw-github-com>

example from the JS console:

 ![23%20AM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8c6124ec00413f18fc2dcc3b39c2650a4ca87906.png)

try using a CDN service like GoToLoop suggested, or download the file and include it in your sketch locally!

---

<div class="post-metadata">

**Author:** ![MrShawn](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MrShawn](https://discourse.processing.org/u/MrShawn)\
**Post date:** [August 31, 2019, 5:27pm UTC](https://discourse.processing.org/t/solved-how-to-import-collide2d/13713/4 "2019-08-31T17:27:08Z")

</div>

Thanks for the link, helps a lot!

---

<div class="post-metadata">

**Author:** ![MrShawn](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MrShawn](https://discourse.processing.org/u/MrShawn)\
**Post date:** [August 31, 2019, 5:27pm UTC](https://discourse.processing.org/t/solved-how-to-import-collide2d/13713/5 "2019-08-31T17:27:45Z")

</div>

Ooh, okay, that makes sense. I looked up how to import a library and saw someone use a rawgithubcontent link before so I figured it would work for me. Thanks for explaining it!
