Saturday, 10 June 2017

ELI5 Including an npm package

I understand including packages in an app using a framework such as Angular 2, but I'm lost when it comes to including a package into static, fully custom websites. For example:

  • I create the package.json file, great.
  • I install and --save the package into the package.json file, great.

Now what? For Javascript packages it typically says to write the require(''); line or for CSS packages it might say to include the @import('');, but where?

Typically I'm just running a static site with a /css and /js folder. Do I insert the require() or import() in the main JS or CSS file? If so, how does it know to read into the /node_modules folder?

Thanks in advance.



via Joe Berthelot

No comments:

Post a Comment