Hacker News new | ask | show | jobs
by Ronsenshi 4242 days ago
Checked some of the available components and it seems like it should be possible to "just include" .js with the component and use in in the app. Not the best way to go about it as it is not that good of a practice, but possible nevertheless.

This is all about modules. It is a good programming practice to turn piece of code that can be used in multiple projects into the module, so that it is easier to load them up in the next project.

You can check node.js docs on the example of modules and how your code should work so: http://nodejs.org/api/modules.html

In node.js it is trivial - just like loading external modules in python (if you ever worked with it).

RequireJS is a tough nut, I give you that. That's mainly because of the asynchronous nature of the script loading on the web. Can't really recommend anything on the topic. I myself spent quite some time before it clicked.

1 comments

Thank you for the advice. I will forge on as I suppose that is the only option!