AI Assistant

External Libraries

You can add any npm package to your WordPressify project and include it in the build.

Example: Adding a Library

Install the package:

npm install jquery

Then add it to the appropriate bundle array in gulpfile.js:

/* -------------------------------------------------------------------------------------------------
Header & Footer JavaScript Bundles
-------------------------------------------------------------------------------------------------- */
const headerJS = [ './node_modules/jquery/dist/jquery.js' ];
const footerJS = [ './src/assets/js/**' ];
  • headerJS - Loaded in the <head> before the DOM renders. Use this for libraries that other scripts depend on immediately.
  • footerJS - Loaded at the end of <body> after the DOM is ready. Only footer scripts are processed through Babel (ES6 support). Your custom code should go here.

You can configure Babel to also process header scripts by modifying the corresponding gulp task in gulpfile.js.

Changes to gulpfile.js require a build restart to take effect. Stop the server with CTRL/CMD+C and run npm run start again.