I'm trying to figure out how to use external javascript libraries in the Atom editor. I used npm to install the momentjs library, since Atom uses node. However, I'm puzzled as to what to do now? I can't find a way to use the library in Atom.
I thought that I could go to the Atom init.coffee file and do a require "moment" (also tried require "momentjs") but nothing seems to work.
The whole reason behind this is so I can use some javascript libraries for formatting dates in a snippet (I have another SO question about that which I'll close if this solves it).
But this question is a general question about installing and running javascript libraries in Atom. I've looked through the Atom docs and Googled, but I can't find a good answer. I figured something like this would be pretty easy?
momentjsthrough Node.js so it can only be used in Node.js. Is your aim to make a server-side snippet for use in Node.js or a client-side snippet for use in the browser? Also, Atom is just an editor, it helps you edit files which you must create - it's not going to help yourequiremoment which innodejswould be done with:var moment = require('moment');