If I am building a WordPress theme, do I need to include the node_modules folder in the finished theme or it's only used for development? When running my git commit, should I ignore the node_modules folder?
It depends what you're using node modules for, but I'm assuming because you've tagged gulp
you're using node to handle assets. In my case we use webpack for compiling scss and javascript.
For example, if we had a imports from npm...
app.js
const PluginExample = require( '@creator/plugin-name' );
app.scss
@import `~bootstrap/scss/functions`;
In development, the imports would be loaded from the node_modules
directory, but in production it's compiled into the same file so we can delete the modules directory.
You should know what you're using node for, however, you could try running your production build process locally, deleting the node_modules
directory and then see what happens.