.DEFAULT_GOAL := help
.PHONY: *

install: clean setup build ## Clean the vendor directory, run composer install, build the theme

clean: ## Clean the vendor directory and the node modules
	@echo "clean"
	@rm -rf public/wp-content/themes/proudnerds/vendor public/wp-content/themes/proudnerds/node_modules

setup: ## Run composer install and compile the theme
#	@echo "composer install"
#	composer install
	@echo "node install"
	@cd ./public/wp-content/themes/proudnerds/ && npm install

build: ## Build the theme assets
	@echo "build theme"
	@cd ./public/wp-content/themes/proudnerds/ && gulp build

update:
	composer update
watch: ## Build the theme assets and watch for changes
	@cd ./public/wp-content/themes/proudnerds/ && gulp default

sync: ## Build the theme assets and watch for changes with browser sync
	@cd ./public/wp-content/themes/proudnerds/ && gulp dev

help:
	@printf "\033[33mUsage:\033[0m\n  make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n"
	@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'