# How to properly include particles.js in sage 9?

**URL:** https://discourse.roots.io/t/how-to-properly-include-particles-js-in-sage-9/11810
**Category:** sage
**Tags:** sage9
**Created:** 2018-03-05T06:40:54Z
**Posts:** 4

## Post 1 by @ritish — 2018-03-05T06:40:54Z

Hello :slight_smile: , I have been trying to integrate particlesjs for my custom theme but it wasn’t sucessfull.  
I followed these two relevant threads [https://discourse.roots.io/t/sage-9-external-js-not-defined/9860](https://discourse.roots.io/t/sage-9-external-js-not-defined/9860) and [https://discourse.roots.io/t/which-way-is-the-correct-way-to-include-extra-js-files-in-sage-9/8926/2](https://discourse.roots.io/t/which-way-is-the-correct-way-to-include-extra-js-files-in-sage-9/8926/2) to include particles js but it didn’t worked either.

Has anybody successfully integrated particlesjs in sage 9 theme ? Any help on this would be great. Thankyou

---

## Post 2 by @kLOsk — 2018-03-05T08:20:44Z

Mhm this istn tested but I’d say:  
**yarn add particlesjs** (or **yarn add particles.js** ([https://yarnpkg.com/en/packages?q=particlesjs&p=1](https://yarnpkg.com/en/packages?q=particlesjs&p=1)))

Then you have to import in common.js

```
import {particles} from 'particlesjs';
```

and

```
export default {
  init() {
particlesjs.init({
    selector: '.background'
  });
...
```

---

## Post 3 by @ritish — 2018-03-06T17:31:37Z

thanks , i tried that way it didn’t worked

---

## Post 4 by @Collin_Berg — 2019-04-13T03:12:33Z

I also have this problem.

**yarn add particlesjs** is a stripped down version of the other version. the solution above works (I removed the {} around particles).

I tried,  
**yarn add particles.js**

with my home.js being this:

```
import {particlesJS} from 'particles.js';
export default {
  
  init() {
    // JavaScript to be fired on the home page
    particlesJS.load('particles-js', {JSON settings});

  },
  finalize() {
    // JavaScript to be fired on the home page, after the init JS
  },
};
```

But when i do that, and import in the home. I get load not defined.

Did you ever figure it out?
