folks. It's stupid question time again.
I was looking into using particles.js as a background as i learned to use node and express. On the documentation available on the github, it says to use:
npm install particles.js
After doing this, i've added this to call it in my app.js:
var particleJS = require("particle.js")
At this point however, when i try to run my app, nodes error states:
ReferenceError: window is not defined
There is also another code block which is supposed to be called to create this which is supposed to be run on the frontend, using a jade file.
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
particlesJS.load('particles-js', 'assets/particles.json', function() {
console.log('callback - particles.js config loaded');
});
There's a few things i'm not too sure about. Firstly, from my fun with node, npm install modules should be able to be called in the app.js. So i find it strange that it doesn't work.. Is this because the code in question isn't based around using a framework like express?
Secondly, if this is the case and i've installed the particles.js module through npm, in order to have jade pick it up, i'd have to copy the js over to the "javascript" public directory so it can find it?
And if thats the case i don't need to have it installed through npm in the first place?
So many questions... sorry. I'm still learning, and getting a little run around with this. Maybe my logic is wrong somewhere.
Can anyone help?