Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs Usage example doesn't work with npm Install. #477

Open
ZackPlauche opened this issue Sep 2, 2021 · 1 comment
Open

Docs Usage example doesn't work with npm Install. #477

ZackPlauche opened this issue Sep 2, 2021 · 1 comment

Comments

@ZackPlauche
Copy link

The usage docs don't make any sense on how to use this with node.

Do you have to import the CSS as well?
How do you import it from node_modules?

And why is this part not discussed in the docs?

@DanielOberlechner
Copy link

DanielOberlechner commented Nov 16, 2021

Hi,
it's not discussed because there isn't any...
Have a look:
https://cdnjs.com/libraries/particles.js

You'll see there is only a js to implement.
Compile the node_modules/particles.js/particles.js and implement it on your site.
Then set a dom id to: "particles.js".
In my case it was body:

Then you probably don't want the default behaviour of this library so you go here:
https://vincentgarreau.com/particles.js/

Play around with the styles until you're happy and download the particles.json.

Now make on your webserver the particles.json possible to get loaded.
In my case it is django and I did put it in the static directory so it can be loaded.

Next simply use the following JavaScript at the end of your site:
document.addEventListener("DOMContentLoaded", function() { particlesJS.load('particles-js', 'particles.json'); });

Now you are done.

If you have any trouble feel free to contact me here,
I'll try my best to help you. :)

Kind regards,
Daniel Oberlechner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants