Tar command to exclude directories
Need to exclude specific dirs when wrapping a site up to push to production, specifically bower_components
and node_modules
. Run this command from the site root of your WP install.
tar --exclude='wp-content/themes/THEME_NAME/bower_components' --exclude='wp-content/themes/THEME_NAME/node_modules' -zcvf SITE_NAME.tar.gz *.php wp-admin/ wp-content/ wp-includes/
NOTE: leave trailing ‘/’ off the path of dirs to exclude as tar
doesn’t like it.