Home > Software engineering >  How to integrate node packages in CodeIgniter 4?
How to integrate node packages in CodeIgniter 4?

Time:10-05

How to integrate node packages in CodeIgniter 4?

I build a web app with CodeIgniter 4 and I want to add some libraries. I'm used to use npm with my JavaScript Web Apps and I'm wondering what is best practice to use npm with CodeIgniter 4.

  1. Where do I initiate npm? In root or in /public/assets or somewhere else?
  2. Once I installed a package (e.g. npm install animate.css --save) how do I reference the package in my app? Do I use <link href="<?=base_url();?>/assets/node_modules/animate.css/animate.min.css" rel="stylesheet" />
  3. Once I deploy my app to production, do I deploy the node_modules as well?

CodePudding user response:

copy node files in public/js then call it in footer

call it here
  • Related